[gambit-list] ##namespace fun

Adrien Piérard pierarda at iro.umontreal.ca
Wed Jul 15 01:49:54 EDT 2009


2009/7/15 lowly coder <lowlycoder at huoyanjinjing.com>:
> Why can't I do the following:
> (define-macro (module name)
>  ,(begin
>     (##namespace (string-append (object->string ,name) "#"))
>     (##include "~~lib/gambit#.scm")))

Because nesting two unquotes without any backquote is likely to be meaningless.
Because even if you did that properly, (string-append (o->s ,name)
"#") is still a list whose CAR is string-append, instead of being a
string (or a list whose CAR is a string, I dunno the syntax of
namespaces).
Because if you hade done the two above steps properly, it would probably work.


(define-macro (module name)
  `(begin
     (##namespace (,(string-append (object->string name) "#")))
     (##include "~~lib/gambit#.scm")))
(module tata)
(define toto 0)
(pretty-print tata#toto)

Does this do what you want?

P!


-- 
Français, English, 日本語, 한국어



More information about the Gambit-list mailing list