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

RE: And how expressive are they if we ignore speed?



Jakub Travnik wrote:
> Blocks can be used to affect evaluation order. If they are enough
> succinct this is ok.  Moreover this is non-issue in pure functional
> languages.

On the topic of the need for macros in pure (lazy) functional languages with
succinct closure syntax, Oleg Kiselyov's macros talk which I referenced
earlier, refers to a paper by Keith Wansbrough entitled "Macros and
Preprocessing in Haskell"
(http://www.cl.cam.ac.uk/users/kw217/research/misc/hspp-hw99.ps.gz), which
makes a case for macros in Haskell.  A quote:

"But functions can be interpreted similarly: a function definition adds a
new operator to the language.  Furthermore, such function definitions are
very well understood and well-behaved, whereas macros have historically been
poorly understood and unreliable [Macros in Scheme, Clinger '91].  So what
is the difference between an operator and a control structure?  What does a
macro give us that a function definition does not?  A macro operates on
syntax, while a function operates on values."

He goes on to mention how Haskell's laziness reduces the need for macros,
but points out some ways in which they are still useful.  A couple of these
are conditional compilation, and the ability to create new syntactic
constructs.  He says the latter should have "freely definable syntax,
possibly involving sequences or other complex translation into the target
language.  Binding should be permitted in a clean manner.  Not just
expression forms but definition forms and other syntactic categories should
be extensible."

Anton