OCaml Language Sucks
sds.podval.org
sds.podval.org
So for example I think criticism like The conspicuous absence of macros cannot be obscured by the presence of preprocessors is witty, but it is really reviewing a language that is a dialect of Lisp with a glaring defect rather than reviewing a language that may or may not provide a different solution to the problems that macros solve.
I'm not very good with them (yet), but I can appreciate the safety guarantees of a good type system (as long as it has decent inference and can avoid the ridiculous verbosity of Java).
As a rule of thumb, if I want to hack something up quickly, and I use Lisp (or python/perl). If I want something safer, easier to maintain (not necessarily extend though ...), etc I like languages with stronger typing and more powerful static analysis.
Oh, and seriously? This one is good for a chuckle. I am convinced that it's an instance of the pattern above. I don't know what version of LISP that does this the author has in mind, but it's not the 50s any more -- we no longer leave batch jobs on punchcards at the computer in the morning to obtain the results in the evening. I would hate if my compiler spat so many errors that the initial, and only pertinent one, scrolled out of the screen:
"Compiler stops after the first error:
Compiler should process the whole compilation unit (normally, a file) unless a total disaster strikes. E.g., if an expression has the wrong type, just assume the type is right and proceed to the next expression. You do not have to generate the executable, just report as many errors as possible!"
I've heard good things about OCaml elsewhere, but my experience with functional languages is limited to a bit of Scheme and Haskell. I've thought about trying out OCaml but this makes me possibly want to reconsider...
For instance, there's no packages for http, json, or xml in the standard library.
Note how instead of saying, "Ocaml doesn't have with-open-file or unwind-protect", he says, "Here's how you have to do with-open-file and unwind-protect in Ocaml". No! You do not go around trying to turn other languages into Lisp if you want to code in Lisp. If you want to code in Lisp, you code in Lisp.
Similarly, he just dismisses the syntax as "pretty much unreadable". Bollocks. The language syntax is fine. Sure, it's different from what most people are used to, unless said people have used SML or Haskell. But it's a decent synatx - yes, with it's own quirks and problems - which is most certainly not "unreadable".
"No Polymorphism; Cannot add an int to a float - need an explicit cast" - what he means to say is that it's a very strong-typed language. If you use the "O" part of "Ocaml" (Objective Caml", polymorphism exists and works.
Now, a lot of his points are valid, like the one about the standard library. But in general, I feel that he really discredits himself by his persistence in writing Lisp code in Ocaml. When in Rome, do as the Romans do.
(Disclaimer: I've used Ocaml, but not to any grand extend. Maybe 10,000 lines of code written in it. Paradigm-wise, I'd have to say I might prefer Lisp, although I find that CL is slightly annoying often times.)
What would be the OCaml solution for the problem that unwind-protect solves? In Haskell, I would use bracket, and appropriately the API documentation of bracket gives the definition of withFile as an example:
withFile name mode = bracket (openFile name mode) hClose
(see http://haskell.org/ghc/docs/latest/html/libraries/base/Contr...)I think this article makes it very clear how having a huge existing set of libraries can really put a language into warp drive, whereas not having one means you are going to spend some time re-inventing the wheel. (But even in straight Ocaml, I fail to see the problem)
http://caml.inria.fr/pub/ml-archives/caml-list/2003/07/5ff66...
Having said that, some of the code to me just doesn't look right. Like the file open nonsense. Why not just write a generic function and use that whenever you need it? Do you really have to repeat all that nonsense every time? Because if you're basically copying and pasting, maybe you're doing something wrong?
I don't know, since I'm a newbie and I'm on F#, not straight OCaml. I know in F# I can get an open file (with error catching) in just a line or so of code.
1/ if you're a newbie at F#, it is not completely unlikely that all the F# you have ever written was valid OCaml. The languages are that close to each other.
2/ the author's criticism is that OCaml is not LISP, not that OCaml is not F#, so all the complaints he has against OCaml very likely apply just the same (note that I am not saying they are valid complaints) to F#.
I took a brief look at OCaml a few years ago and have been meaning to try and learn it properly for a long time now, but never got around to actually doing it. From my very very brief look at F#, it looked really nice. Finally, I don't know much about Scala, but since I'm mostly using Clojure for my own coding (and Java + C++ + JNI in work), maybe staying with a JVM language would ultimately more beneficial?
Thoughts?