[toronto-lisp] OCaml

D. J. Penton djp at arqux.com
Fri Jan 14 00:23:16 UTC 2011


On 2011-01-13, at 8:47 AM, Michael DiBernardo wrote:

> 
> On 2011-01-13, at 8:34 AM, Rudolf Olah wrote:
> 
>> On Wed, 2011-01-12 at 23:33 -0500, D. J. Penton wrote:
>>> I have to get this off my chest.
>>> 
>>> I am now seriously obliged to learn OCaml for use in a course in my
>>> grad program. In 2010 I just tinkered with the language. But the
>>> honeymoon is over.
>>> 
>>> So far I hate OCaml more than words can say. Maybe it's the book I'm
>>> using to learn it. I ordered a different book from Amazon. I hope the
>>> new book helps. If not I shall suffer grievously throughout the term.
>>> I don't half mind Haskell, but Holy Snapping Assholes, Batman - not
>>> OCaml, pleeeeease.
>> 
>> 
>> What is it that you hate about it? I tried it out briefly and it looked
>> ok. Something like haskell except imperative/deterministic ;p I liked
>> the pattern matching.
> 

See my comments below. I only learned about pattern matching a few months ago and I really like it too. It's one of those things I wonder how I got along without before, back when I knew nothing but C, Simula, and a little java.

> I think a lot of what attracts people to functional languages the first time around is simplicity of implementation. This is in the sense that the programming model itself provides the richness, rather than relying on hundreds of different, specific language features being added to the spec/compiler.
> 
> OCaml is sort of the C++ of functionally-oriented languages in that there are a huge number of features built right into the language, each with their own specific syntax. This can get frustrating when you accidentally misuse your intended syntax and stumble into a feature that you didn't even know about. When you compound this with the fact that the error messages from the compiler aren't the greatest (at least they weren't during my last, circa-2008 experience), it does feel sort of plodding.
> 
> I am one of those people that loves OCaml for its quirks. However, I can appreciate why the haters continue to hate on it :)
> 
> -Debo
> 
> Disclaimer -- I have never done anything significant in Common Lisp; I've always restricted myself to a Scheme of one flavour or another. So it's possibly that my comments about both syntactic and general simplicity are off base.
> __

Michael: You have hit the nail right on the head. Basically my complaint is about syntax, and perhaps also about too many features (not sure on the features issue). The syntax seems ad hoc and a little cryptic. Perhaps it is no coincidence that I have also always disliked C++.

I will admit that once I am past the worst part of the learning curve I'll probably wonder why I ever griped about OCaml. Who knows, maybe it will become my favourite language some day. And I really do accept that arguing about the merits of programming languages is like arguing about whether asparagus tastes good or not: it's largely a subjective judgment.

But for now I am annoyed to be back in the position of looking at some syntactic construct in OCaml and asking myself "what the hell is this meant to do?" My irritation is probably amplified by having tackled Lisp and Scheme over the past year and a half. I adore these latter languages because there is so little syntactic stuff to wade through. Unless someone has gone berserk with bizarre macros, I spend very little time mentally unravelling the syntax of CL when I try to understand some code. Scheme and CL allow me to jump right to being baffled at level much deeper than the syntax!

As I suggested in my original post, some of my problems are the result of using a poorly written (IMHO) book. I grabbed a better one today. Maybe it will help me see the OCaml light at the end of the tunnel.

End of rant.

- Dave -



More information about the toronto-lisp mailing list