[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Macros in Dylan
Peter J. Wasilko, Esq. writes:
>
> Apple's Dylan language incorporated a Macro system that
> distinguished between Definition Macros, Statment Macros, and
> Function Macros (which seemed to have distinct hooks in the Dylan
> grammar itself) along with a few other interesting features like a
> provision for intentionally violating hygiene.
>
> Has anyone on the list made use of those facilities, and if so,
> could they comment on any lessons we might draw from the Dylan
> experience?
As a lower bound, Scott McKay, Eric Kidd, and Johnathon Bachrach all
probably have more experience with Dylan's macros than I do, but
here's my two cents:
Dylan's macros are very similar to Scheme's syntax-rules macro system.
That is, you write macros by defining a set of patterns the lexical
syntax is matched against, and then the patterns are rewritten
according to the matching templates. Unsurprisingly, the strengths and
the weaknesses of Dylan's macros are very similar to Scheme's macro
system.
Its great strength is that simple macros are easy to write, and its
great weakness is that complex macros are an exercise in pain, since
it's all but impossible to properly structure a macro. in fact, I
think that this is one of the great weaknesses of most current macro
languages: there's no good way to decompose a macro definition in the
way that regular programs can be.
--
Neel Krishnaswami
neelk@alum.mit.edu