Macros
Richard
ru@river.org
Sat, 5 May 2001 04:44:15 -0700 (PDT)
Norman Ramsey writes:
>When I compare Lisp and Haskell, the big question in my mind is this:
>is lazy evaluation sufficient to make up for the lack of macros?
it might make sense for Haskell to have a facility that makes it
possible for the programmer to define new bits of syntactic sugar
without changing the compiler.
eg, I recently wanted
case2 foo of ...
as sugar for
foo >>= \output->
case output of ...
if you want to call such an easy-sugar-making facility a macro
facility, fine by me. personally, I wouldnt bother with such a
facility.
aside from simple macros that are just sugar, macros go against the
Haskell philosophy, imo, because macros do not obey as many formal laws
as functions do and because a macro is essentially a new language
construct. rather than building what is essentially a language with
dozens and dozens of constructs, the Haskell way is to re-use the 3
constructs of lambda calculus over and over again (with enough sugar to
keep things human-readable).