4 ms·
Ergh! Sure, some of these things are true, but some just reek of a stubborn refusal to do things the way the language intends for them to be done. Note how ins
by PieSquared 17y ago
Ergh! Sure, some of these things are true, but some just reek of a stubborn refusal to do things the way the language intends for them to be done.
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.)
- noste 17y ago"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." 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/Control-Exception.html#v:bracket http://haskell.org/ghc/docs/latest/html/libraries/base/Contr...)
- DanielBMarkham 17y agoFWIW, F# has "using". Between "using" and IDispose, you've got all the resource-unlocking, unwinding, and rollbacks you'd ever want. 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)
- nearestneighbor 17y agoYou can implement your own unwind-protect: http://caml.inria.fr/pub/ml-archives/caml-list/2003/07/5ff669a9d2be35ec585b536e2e0fc7ca.en.html http://caml.inria.fr/pub/ml-archives/caml-list/2003/07/5ff66...