On Sun, Apr 26, 2009 at 10:59 PM, Grant Rettke <[email protected]> wrote:
> By definition, if you want to write portable macros, you only need to
> understand how to write portable macros :).

Yes, but that means understanding phase separation and the tower of metalevels.
For instance, here is an example from a future episode:

(library (experimental ct-mapping);; a compile-time mapping with introspection
(export ct-mapping)
(import (rnrs) (sweet-macros))

(def-syntax (ct-mapping (name value) ...)
  #'(syntax-match (<names> name ...)
      (sub (ctx <names>) #''(name ...))
      (sub (ctx name) #'value)
      ...))
)

To get the macro working portably, I have to use it as follows:

(import (rnrs) (for (rnrs) (meta -1) (for (experimental ct-mapping) expand)
(def-syntax color (ct-mapping (red #\R) (green #\G) (yellow #\Y)))
(display (color <names>))
(display (color red))

Therefore I have to explain why (meta -1) is needed (that's not so easy).
Once I have explained that, I can also explain why in Ikarus it is not
needed (that's easy).
In short, for the kind of macros that I am interested in (which are not
that advanced, after all) a full understanding of phase separation is needed.

Reply via email to