[Haskell] Re: [Haskell-cafe] Haskell versus Lisp
glynn at gclements.plus.com
Fri Sep 16 18:26:01 EDT 2005
Tomasz Zielonka wrote:
> > Every other language (including Haskell) tends to have the problem
> > that eventually you will encounter a situation where the language's
> > own worldview gets in the way.
> Are you sure that lisp's worldview never gets in the way?
I wouldn't say never. But it's main advantage is that it doesn't
really have much of a worldview.
Its primary composite data type is the heterogeneous linked list,
which is isomorphic to both binary trees and n-ary trees. This
provides a reasonable fit for most common data structures, and also
for most languages (anything defined by a recursive grammar can be
represented as a parse tree).
The complete absence of keywords is another useful feature (I've lost
track of the various C packages which had to have identifiers named
"class" renamed to allow for C++). Even "quote" is just another
Ultimately, all languages are limited by their choice of primitives.
> > Or, to put it another way: if Haskell is so flexible, why do we need
> > Template Haskell?
> It's nice to have Template Haskell, but saying that we need it is a bit
> of an overstatement. In the GHC Survey 2005 only 9% of people said it's
> essential. Well, OK, I was one of them, but I think you know what I
> > I can't imagine a "Template Lisp"; it would just be Lisp.
> The power of lisp macros is often overrated. I remember a long
> discussion crossposted on comp.lang.lisp an comp.lang.functional. The
> lisp advocates gave examples for how macros allow to do things
> supposedly unavailable in other languages. Surprisingly, most of these
> things were equally easy to do with higher-order functions and closures
> in Haskell.
> I am sure that lisp gurus can achieve great things with macros, but I'm
> not sure they are the best tool for software engineering problems.
> I think they can make the code more difficult to understand, make the
> semantics less uniform (despite the uniform syntax), and can become an
> abused ugly hack.
Well, this is heading towards the inevitable paradox (Gödel's theorem,
halting problem, etc). If you allow the programmer to escape from your
chosen semantic model, you no longer have the luxury of being able to
assume those semantics.
Ultimately, the issue isn't whether shooting oneself in the foot is a
good idea, it's whether you leave it up to the language or to the
programmer to prevent it. Both have their pros and cons.
In that regard, Lisp and Haskell are almost opposite extremes, with
more conventional languages inbetween. Haskell's safety and
consistency can get in the way, while Lisp's freedom can be quite
unsafe and inconsistent.
> Don't get me wrong - I still think that lisp is one of the best
> programming languages around and from time to time I am trying to learn
> a bit of it. One of the things that puts me off is the attitude of its
> community - it seems to be very close minded.
Hmm. That depends upon which faction of the community you're dealing
with. If you get into discussions about the merits of Lisp on public
fora, you'll likely be dealing with the evangelists. Language
evangelists are often closed-minded whatever the language.
Glynn Clements <glynn at gclements.plus.com>
More information about the Haskell