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

Re: RE: succinctness = power



On -1 xxx -1, Matthias Felleisen wrote:

> Finally, I argue that using NON-local transformations to implement
> patterns as linguistc constructs takes away a lot of explanatory power
> from the programmer.

I agree.  The kind of non-local transformations we found most useful fell
into two camps:

- transformations on constructs very close to, but not directly enclosed
by, the macro.  For example, annotating a field (eg, as a JavaBeans
property) might trigger the addition of a few methods and an interface
declaration to the class.
- non-intrusive extensions of other constructs, like the example I gave of
adding a visit() method to a visitor interface.  How "non-local" this
seems depends largely on how accustomed you are to such extensions;
adding methods to other classes is not a big deal for those used to
Smalltalk or Ruby, less comfortable for those used to C++ or Java.

I'm not necessarily arguing for unrestricted scope of transformation; for
one thing, the fact that ELIDE allows it forces batch compilation, which
makes it impractical in a lot of situations.  I do think that macros are
too restrictive.  Somewhere in between there may be a sweet spot.  For
Lisp, for example, it might be interesting to look at what you could do
with a "macro" that affected both its scope and its enclosing scope but
no further.  This would get around some of the composability issues I have
with lisp macros, in that you can have multiple macros operating in the
same scope (yes, you'd need all kinds of messy dependency stuff to order
them correctly...)

Avi