Manuel Chakravarty wrote:
> Jan Skibinski <[EMAIL PROTECTED]> wrote,
>
> > If a good pre-processor is still a valid option, would not
> > something similar to Camlp4 be better than the plain CPP?
> >
> > Camlp4 ===> http://pauillac.inria.fr/camlp4/
> >
> > "Camlp4 is a Pre-Processor-Pretty-Printer for Objective Caml.
> > It offers syntactic tools (parsers, extensible grammars), the
> > ability to extend the concrete syntax of Objective Caml
> > (quotations, syntax extensions), and to redefine it from
> > scratch."
> >
> > If such a Haskell-specific tool existed and had the
> > ability to support any syntactic extensions to Haskell
> > then people would not have to worry too much about
> > syntactic incompatibilities, would they?
>
> The problem is that a pre-processor adds a new level of
> semantic complexity to the language - so if we can do
> without it, we'll definitely make our lives simpler.
>
> Besides, one nice property of Haskell is its relatively
> (compared to other languages) precise semantic definition
> (ie, the translation to the Haskell kernel). A
> pre-processor wouldn't fit nicely in here, I suppose.
Camlp4 is not part of the language definition for Ocaml, and I don't know if
Jan is necessarily advocating that an analogue would need to be part of the
one for Haskell. If you don't mind parsing your source twice, a Camlp4-like
processor can just output plain old Haskell. The actual Camlp4 can also
output a binary form of Ocaml's ASTs, and a special switch on the compiler
(there is only one implementation of Ocaml! :) reads it in directly and
avoids reparsing.
--FAC