[Haskell-cafe] Language simplicity

Martin Coxall pseudo.meta at me.com
Wed Jan 13 03:49:40 EST 2010


On 12 Jan 2010, at 21:25, Andrew Coppin wrote:

> OK people, it's random statistics time!
> 
> Haskell '98 apparently features 25 reserved words. (Not counting "forall" and "mdo" and so on, which AFAIK are not in Haskell '98.) So how does that compare to other languages?
> 
> C: 32
> C++: 62
> Borland Turbo Pascal: ~50 [without the OOP extensions added later]
> Eiffel: 59
> VB: The source I checked listed in excess of 120 reserved words, but I'm dubious as to how "reserved" they really are. (Is CInt really reserved? I doubt it!) It also depends wildly on which of the bazillion VB dialects you mean.
> Java: 50
> JavaScript: 36
> Smalltalk: 0

There are six singleton pseudo-variables that act as reserved words: true,false, nil, self, super and thisContext.

> Lisp: AFAIK, there are no truly reserved words in Lisp, only predefined functions. (??)

All Lisps have "special forms" which are evaluated uniquely and differently from function application and are therefore reserved words by another name. For example, Clojure has def, if, do, let, var, quote, fn, loop, recur, throw, try, monitor-enter, monitor-exit, dot, new and set!.

> Python: 31
> Ruby: 38
> Tcl: Same analysis as for Lisp I believe.

COBOL: Over 400 (!)

> 
> As you can see, this conclusively proves... something.

Generally speaking, the most widely used languages seem to be near the upper end of the range.

I don't think it really tells you that much. Possibly that a little superficial complexity through syntactic sugar can make your language a lot more human-friendly, but that it's possible to go too far and end up like C++.

Martin


More information about the Haskell-Cafe mailing list