Strict Types

Posted on Nov 09, 2011

When I first heard about Haskell I admit I was quite enamoured with the idea of correctness at the time. I had been working on a string of projects fraught with errors and bugs largely due to types. I had become frustrated with dynamic languages. It just seemed that they were too easily abused to be useful for large projects. As well I had also begun to develop an interest in mathematics and the concept of proof was something I saw as valuable.

I found myself dusting off my dog-eared copy of The C++ Programming Language today. As I leafed through some random passages I came across a bit of wisdom that had reminded me of my initial contact with Haskell. “Good design and the abscence of errors cannot be guaranteed merely by the presence or the absence of specific language features.”

(For some reason this also struck me as profound coming from the inventor of C++…)

As I delve more and more into Common Lisp I find myself wondering what advantage draconian enforcement of a set of language features has. I see Haskell and I marvel at the contortions one must be willing to accept in order to get useful work done. I work with Python day in and out and wonder why the community accepts the rule of a dictator (even if that “dictator” is now a small committee) to tell them what features are good and worth implementing. If I wanted big, nasty lambdas everywhere why shouldn’t I have them and be left to suffer the consequences and benefits myself? What if I really do want recursion? Or eager evaluation? Or lazy evaluation? Or types? Or no types? Or immutability? What if I don’t accept your defaults or conventions?

I actually have a funny spot for languages that encourage freedom of expression over correctness. I think Common Lisp has that in spades; you can program the language to do what you need it to to solve your problem. To a degree you can also do that with C++. And Perl. And maybe even Javascript too. Who knows? Either way I still prefer clear thought-out design, but I also like to break the rules when I see fit to. And I like languages that let me do that.