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.
Pray for me.
- Dave -
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.
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.
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.
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 -
On 01/13/2011 04:23 PM, D. J. Penton wrote:
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++.
The let syntax is mathetmatical. You're supposed to read it out.
So if I say let x be a value in the set I convert that into ocaml:
let x = choose set in
so let x equal a value IN
then the rest follows.
So what I recommend about syntax is avoid semi colons.
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!
Another problem with ML is that the module structure is pretty hairy. It works great but it takes a while to really get it.
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.
OCaml has bad syntax, but what it does have is great static typing, pattern matching and performance.
So if you have a problem in OCaml and it doesn't make sense, add more types! Type inference is your friend!
An example is mixing indices (ints), identifiers (ints), and counts (ints).
If you made 3 seperate types:
type index = Index of int type ident = Identifier of int type count = Count of int
Then when you type check you won't mistake an Index for an Identifier and you won't mistake a Count for an int.
I've run into this with data versus frequency count.
type data = Data of int array type freq = Freq of int array
It is very easy to confuse two arrays of integers, until they have different types :)
Basically you'll like ocaml if you have to write parse trees. It's great for trees :)
abram
End of rant.
- Dave - _______________________________________________ toronto-lisp
mailing list toronto-lisp@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/toronto-lisp
On Thu, Jan 13, 2011 at 8:04 PM, Abram Hindle abram.hindle@softwareprocess.es wrote:
On 01/13/2011 04:23 PM, D. J. Penton wrote:
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++.
The let syntax is mathetmatical. You're supposed to read it out.
So if I say let x be a value in the set I convert that into ocaml:
let x = choose set in
so let x equal a value IN
then the rest follows.
So what I recommend about syntax is avoid semi colons.
One of the things I find weird about the let-syntax in Ocaml is the indentation style that's commonly used. Ocaml programmers don't indent the code that follows the "in" keyword, whereas in Lisp we would certainly indent the body of a (let (...) ...).
See, for example, the raytracer code here: http://www.ffconsultancy.com/languages/ray_tracer/comparison.html The let-syntax is always on the same indentation level as the code following it.
I guess that's just Ocaml's style and it makes sense in that language. However it's something that can be confusing for a Lisp programmer at first glance.