Hello!
I'm new to scheme and gambit. I've read "A tour of scheme in Gambit", and now I'm learning the language through "The scheme programming language" ( http://www.scheme.com/tspl3/). My question concerns define-syntax VS define-macro. If I understood well, the first is standard scheme (*) whereas the latter is not. Besides, "A tour of scheme in Gambit" qualifies define-macro as "unhygienic" (**). Moreover (as I am from Haskell), I find define-syntax's pattern-matching simpler. So: 1) What is the point of define-macro? Why does "A tour of Scheme in Gambit" encourages to use it, since it doesn't detail define-syntax? 2) Why does gambit run by default in a non-standard mode (Gambit scheme, gsc -:S) in which define-syntax doesn't exist whereas it is standard? 3) I plan to use termite, which uses Gambit Scheme and not standard scheme (gsc -:s). Can gambit scheme code call to procedures written in standard scheme?
Thanks!
(*) By 'standard' I mean R5RS. (**) Word which, from my newbie point of view, kind of sounds like "evil" or "don't-you-touch-it".
Afficher les réponses par date
First off, define-macro predates define-syntax. Also, sometimes you need a macro system that is nonhygenic, such as when you want to inject new symbols into the environment. Once compiled all your scheme code can play together nicely.
On Fri, Jul 30, 2010 at 1:50 PM, Yves Parès limestrael@gmail.com wrote:
Hello!
I'm new to scheme and gambit. I've read "A tour of scheme in Gambit", and now I'm learning the language through "The scheme programming language" (http://www.scheme.com/tspl3/). My question concerns define-syntax VS define-macro. If I understood well, the first is standard scheme (*) whereas the latter is not. Besides, "A tour of scheme in Gambit" qualifies define-macro as "unhygienic" (**). Moreover (as I am from Haskell), I find define-syntax's pattern-matching simpler. So:
- What is the point of define-macro? Why does "A tour of Scheme in Gambit"
encourages to use it, since it doesn't detail define-syntax? 2) Why does gambit run by default in a non-standard mode (Gambit scheme, gsc -:S) in which define-syntax doesn't exist whereas it is standard? 3) I plan to use termite, which uses Gambit Scheme and not standard scheme (gsc -:s). Can gambit scheme code call to procedures written in standard scheme?
Thanks!
(*) By 'standard' I mean R5RS. (**) Word which, from my newbie point of view, kind of sounds like "evil" or "don't-you-touch-it".
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Okay, so I had not understood the sense of "non hygienic".
Once compiled all your scheme code can play together nicely.
But what if I run all the code with the interpreter?
And why is define-syntax deactivated by default?
The idea is that I think it is a good habit when programming to learn the standard, and then use extensions to carry out the things which can't be done (or can't easily be done) with the standard.
2010/7/30 Frederick LeMaster fred.lemaster@gmail.com
First off, define-macro predates define-syntax. Also, sometimes you need a macro system that is nonhygenic, such as when you want to inject new symbols into the environment. Once compiled all your scheme code can play together nicely.
On Fri, Jul 30, 2010 at 1:50 PM, Yves Parès limestrael@gmail.com wrote:
Hello!
I'm new to scheme and gambit. I've read "A tour of scheme in Gambit", and now I'm learning the language through "The scheme programming language" (http://www.scheme.com/tspl3/). My question concerns define-syntax VS define-macro. If I understood well, the first is standard scheme (*) whereas the latter
is
not. Besides, "A tour of scheme in Gambit" qualifies define-macro as "unhygienic" (**). Moreover (as I am from Haskell), I find
define-syntax's
pattern-matching simpler. So:
- What is the point of define-macro? Why does "A tour of Scheme in
Gambit"
encourages to use it, since it doesn't detail define-syntax? 2) Why does gambit run by default in a non-standard mode (Gambit scheme,
gsc
-:S) in which define-syntax doesn't exist whereas it is standard? 3) I plan to use termite, which uses Gambit Scheme and not standard
scheme
(gsc -:s). Can gambit scheme code call to procedures written in standard scheme?
Thanks!
(*) By 'standard' I mean R5RS. (**) Word which, from my newbie point of view, kind of sounds like "evil"
or
"don't-you-touch-it".
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
On Fri, Jul 30, 2010 at 4:21 PM, Yves Parès limestrael@gmail.com wrote:
Okay, so I had not understood the sense of "non hygienic".
Once compiled all your scheme code can play together nicely.
But what if I run all the code with the interpreter?
One solution would be to compile all of your code that uses define-syntax into a loadable module, then you can load that into the interpreter.
But I suspect that you will not be satisfied with that, so run "gsi -:s" to run the interpreter with syntax-case support. Just be aware of the limitations -- as it says on page 51 of the 4.6.0 manual:
"Note that this implementation of syntax-case does not support special forms that are specific to Gambit."
See Marc (if you're listening/reading) some people actually *do* read the documentation :-D
And why is define-syntax deactivated by default?
The idea is that I think it is a good habit when programming to learn the standard, and then use extensions to carry out the things which can't be done (or can't easily be done) with the standard.
Standards often don't line up with the way some folks want to do development. Just because something is a standard doesn't mean it is the best way to do things (in fact, the opposite can be true -- design-by-committee can lead to bloated, unmanageable code).
I for one am glad that Gambit leans toward non-hygenic macros. I was trying to decide whether to get comfortable using Common Lisp or Scheme first. I liked Common Lisp's non-hygenic macros, but I also really liked the consistency and simplicity of Scheme. Gambit allows me to have both. Also, the ability to compile to C is a big plus also IMHO.
REPLeffect
[snip]