Alan Bawden <[EMAIL PROTECTED]> writes:
> A macro facility is like a pair of vise-grips (if you don't know what
> those are, see http://www.technogulf.com/ht-vise.htm).

I found myself laughing heartily at this apt analogy.  I have heard
vice grips described as "the wrong tool for every job."  (My own
experience with vice grips backs this up).

That being said, there are a number of things one might want out of a
macro facility, and I think they should be carefully distinguished:

1) The ability to name expressions without evaluating them, e.g. to
   cook up a facsimile of laziness.
2) The ability to parrot source code (and maybe source position) back
   at the user, e.g. Alan's assert macro, or its C equivalent.
3) The ability to create new binding constructs.
4) The ability to create new declaration constructs.

(1) is pretty well covered by lazy evaluation.  

For (2), I wonder if a clever set of compiler-supplied implicit
parameters might do the trick---after all, "the position of expression
e" and "the source code of expression e" are dynamic notions that
could be carefully defined.

(3) is trickier.  Contrast monadic code before and after "do" notation
was introduced.  Haskell made it possible---not even very hard---to do
monadic binding, but there was a good deal of ugly syntactic noise.
The introduction of "do" notation eliminated that noise.  My instinct
is that this isn't so easy for things that can't be shoehorned into a
monad.  For example, I use the Utrecht attribute grammar tool, and
have trouble imagining how grammars could be coded in pure Haskell
while preserving nice naming properties.

(4) is harder still.  Polytypic classes are a huge step in the right
direction.  What I most long for, though, is the ability to synthesize
new types and new classes---not just simple instance declarations.

As you can probably guess, I think (3) and (4) are the most profitable
avenues of exploration.  And I'm pretty sure I _don't_ want syntax
macros for these.  I'm still waiting to be convinced what I do want.

-Jan-Willem Maessen
Eager Haskell project
[EMAIL PROTECTED]


_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to