[Prev][Next][Index][Thread]

Re: Crash course on macros?



> From: Hugh Greene <q@tardis.ed.ac.uk>
> Subject: Re: Crash course on macros?
>
> ?? NAME   On LHS, after #key only, binds NAME to sequence of all values
> of all occurences of keyword NAME; constraints apply to each
> occurence individually.  On RHS, "??NAME, ..." inserts all
> bound values separated by ',' (can use ';' or
> BINARY-OPERATOR).

Imagine you're explaining this to someone who's rather confused by it...

> ?= NAME   On RHS only, inserts reference to NAME in the lexical context
> where the macro was called (i.e., breaks macro hygiene).

This isn't currently implemented in d2c (Gwydion Dylan). :-(
You can still pass names in from the lexical context as ?var:name pattern
variables, block() style.

As suggested on gd-hackers, if \= and = don't work (they do sometimes...)
?equals:token can be a useful fall-back. Raw = obviously works in define
macros: define constant klin = 2; , and maybe should work in fragments. I've
tried using = in auxilliary rules under d2c, but they don't seem to match.

-Rob.



Follow-Ups: References: