[gambit-list] macro vs runtime environment

Pavel Dudrenov dudrenov at gmail.com
Sat Aug 15 12:52:52 EDT 2009


On Sat, Aug 15, 2009 at 12:43 AM, Adrien Piérard
<pierarda at iro.umontreal.ca>wrote:

> > Isn't one of the core tenents of define-macro that it's just lisp code
> > generating lisp code?
>
> For what kind of lisp code?
> Gambit-specific code? Larceny-specific code? Just R4RS-specific code?
> Is it portable?
>
> What define-macro allows is implementation specific, but the bare
> minimum might not even be full R4RS compliant…
>
> > You most definitely did. I don't think I quite understand it yet.
>
> Read it again ^^
>
>
> >> And also, you *want* a different environment than the runtime one…
> > Why? If I want to avoid naming clash, I can just put them in different
> > namespaces.
>
> Err, namespaces are *not* even in R5RS. How would you then expect
> macro to work in previous versions of Scheme ?
>
> Moreover, with a common namespace, what would happen to such code?
>
> (define-macro (foo)
>  (define + (lambda (x y) 42))
>  (pp "foo"))
>
> (foo)
> (pp (+ 1 2)) ;; 42 !!!!!!!!!!!!!!
>
> You would not like that would you?
>
> Consider that,
> "A macro is an external program with takes a scheme source and returns
> a scheme source",
> then "A macro is an external program",
> then you do not want the variables defined in an external program to
> mask thoses of the processed data, do you?
> It's not even a matter of namespace. It's two different worlds.
> The names defined in your OS do not influence the results of the
> programs you write. Yet, your OS is handling your source code as a
> (dummy) macro would do.
>
> Please read Queinnec's book. Or write your own macro expanser.


A bit unrelated, but thanks for recommending that book. I just picked up a
copy yesterday. It looks really good.



>
>
> P!
>
> --
> Français, English, 日本語, 한국어
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20090815/d9c6b1ae/attachment.htm>


More information about the Gambit-list mailing list