Compiler bug

James Hague <>
Fri Apr 12 20:56:57 CEST 2002


Chris Pressey wrote:
>In some ways, Erlang has always struck me as a bizarre combination of
>extremely low-level (assembler-like) concepts and extremely high-level
>(lambda-calculus-like) concepts.

I don't agree.  If you look at how pattern matching works in Haskell and the
ML family of languages, it is limited compared to what Erlang offers.  You
can't repeat a variable, for example:

first_two_are_same([X,X|_]) -> true.

In general, you have to use classic if..then..else statements more often in
these languages, because the pattern matching and guards are _more_
restrictive than in Erlang.  In Erlang you can write beautiful code where
much of the work is done by the patterns.  In other languages with simpler
pattern matching this is discouraged, at least in that the compilers aren't
designed to optimize that kind of code.

If you look at the Core Erlang spec, it's actually similar to what you get
out-of-the-box with Haskell and ML.  But it takes a good amount of work to
compile a legal Erlang program down to the level of Core Erlang!



More information about the erlang-questions mailing list