"Frank A. Christoph" wrote:
> 
> It seems to me that a compiler would be an ideal candidate for being written
> in an imperative language. The number of times GHC has been too slow and
> memory-hungry for me indicates that Haskell is not suitable for writing
> anything as general-purpose as a compiler.
>
> Food for thought. :) I'm in an equivocal mood tonight...

[OK, I'll jump in :-)]

Of course, the first sentence is an invalid generalization. It may (or
may not -- I hope time will prove you wrong and Haskell code will
improve performance-wise) be true that Haskell is not suitable for
writing compilers. But this does not imply that FPLs in general are not
suitable for writing compilers -- or even less suitable than imperative
languages...

It seems to be folklore in the FP community that functional languages
are perfect for this task. After all, it is what they are mainly used
for :-|. I wouldn't dare writing such a beast without pattern matching,
higher-order functions, a powerful type system, and strong support for
recursion -- things imperative languages usually lack completely. OTOH I
have to admit that imperative features come in handy sometimes (eg. for
unification) -- like always.

Compilers like OCaml or SML/NJ are very fast, even though they have to
perform quite some complex stuff. And they are `mostly functional'.

(And please: not another flame war about the definition of
`functional'.)

        - Andreas

-- 
Andreas Rossberg, [EMAIL PROTECTED]

:: be declarative. be functional. just be. ::

Reply via email to