[gambit-list] Can one use define-macro in Gerbil?

Lassi Kortela lassi at lassi.io
Wed Apr 15 04:52:34 EDT 2020


Thanks for sticking around, Iain. It's not a dumb question. Scheme 
macros are unusually difficult to understand especially since the macro 
systems are many and varied. Even experts have trouble with the finer 
points now and then.

Re: Gambit and Gerbil, Gambit follows Scheme standards (R5RS and R7RS) 
faithfully and adds only a minimal number of its own concepts to the 
language, focusing more on efficiency. The main ones are:

- threads
- versatile ports (not just byte and character ports)
- weak references
- keyword arguments and keyword objects
- various introspection facilities

These are useful augmentations but do not change the essential 
programming style or "flair" of classic Scheme.

By contrast, Gerbil is much more adventurous with the core language, 
notably adding actors and methods which are a big conceptual leap. (As 
an amusing coincidence, Wikipedia tells us that Scheme was originally 
invented as a tool to study the Actor model way back in the 1970s, so I 
guess Gerbil brings it full circle :)

As for define-macro, it seems to exist in Gerbil but doesn't work the 
same way it does in pure Gambit:

Gerbil v0.15.1 on Gambit v4.9.3
 > (define-macro (foo x y) `(+ ,x ,y))
 > (foo 2 3)
*** ERROR IN (console)@2.1 -- Ill-formed expression




More information about the Gambit-list mailing list