it seems to me to be like the case of global versus local variable for passing parameters...
thanks for your help P!
On Tue, Aug 25, 2009 at 3:58 PM, Adrien Piérard pierarda@iro.umontreal.cawrote:
2009/8/25 antonitio antonitio@gmail.com:
it works now!
Great! Though, to remind you, having (load "~~lib/define-syntax") in the file that uses it will not work (because it mixes runtime and macroexpansion) You may have to do gsi -e '(load "~~lib/define-syntax")' your-file-with-macros.scm
i didn't know that there's a gambit expansion define-macro (thanks adrien for pointing this out :-)
Since you *will* have bugs if this is your first time with define-macro, I also remind you that you can do gsc -expansion file-with-define-macro-s-used.scm to see what the expanded code looks like.
why using define-macro instead of define-syntax since define-syntax is define in the standard (hence more portable) even though some implementations also have define-macro? is there any advantage of using define-macro? less code? common-lisp-like?
Well, there is much to debate about this, but you first have to compare syntax-rules (which is hygienic and simple) and syntax-case (which I happen to not know at all for I never felt the need to use it). Define-macro allows me to *easily* share state between different macro expansions, to write macros that write macros (that write macros…), and to mask/rebind symbols that are defined in the context calling the macro. I am pretty sure you can do that with syntax-case too, but as I said, I am ill at ease with it.
I let those who use syntax-case make the case (sic) clearer and enlighten both of us.
P!
-- Français, English, 日本語, 한국어