9 ms·
I don't think OCaml is a fad. It's a great language, probably my favorite, but it has so many problems that most people don't/can't/won't use it for any kind of
by tomp 12y ago
I don't think OCaml is a fad. It's a great language, probably my favorite, but it has so many problems that most people don't/can't/won't use it for any kind of real-world problems.
To list just the main problems:
- f*-up licence (open-source, but modifications can only be distributed as source-code patches)
- non-concurrent runtime (because the original developers don't care about it)
- ambiguous syntax which masks bugs
- inconsistent and incomplete standard library (there are replacements, but they too suck)
- shitty REPL (at least on Windows)
Well, that's about it. It's really fast, safe, expressive, as functional as it gets ([EDIT] also: compiled). Definitely one of the better-designed languages, and a great starting point for many other languages (F#, Swift, Rust).
Lately, there has been a lot interesting development that eased development in OCaml (basic overloading, this IDE), and more seems to be coming (concurrent GC/runtime).
- toolslive 12y agoThis caught my attention... - ambiguous syntax: care to give a few examples? - inconsistent & incomplete standard library: the library that comes with the compiler is basically the library of the compiler. Opam probably has everything you need. - shitty REPL. use utop or use emacs. Anyway, I do think people on windows are better of using F#. But that's another discussion.
- tomp 12y agoThis is an nice example I put together about the ambiguous syntax: if a > 0 then print_endline "a > 0" ; match a with | 0 -> print_endline "impossible" | 2 -> match b with | 0 -> print_endline "2, 0" | _ -> print_endline "2, not 0" | 3 -> print_endline "3, something" | _ -> print_endline "something, something" ; print_endline "done" You can see the rest of the discussion here: https://news.ycombinator.com/item?id=8497740 https://news.ycombinator.com/item?id=8497740 OPAM saves lives, that's true, but one still wishes there was a nice library of standard data structures; I use Batteries, which inherit the inconsistency of the standard library (for the sake of compatibility), the other real alternative is Core, which is undocumented.
- mercurial 12y agoI agree about the standard data structures, but there is no getting around the fact that it's not going to happen. You could have a look at Containers[1] if you want a break from Batteries. 1: https://github.com/c-cube/ocaml-containers https://github.com/c-cube/ocaml-containers
- yodsanklai 12y agoI don't see it as a problem. This type of imbricated "match" is so common that you learn pretty fast to always use parenthesis. Also, it's often a good idea to try to match (a,b) instead.
- gnuvince 12y agoNot to be that technically-anal guy, but the syntax of OCaml is not ambiguous from a CS point-of-view. However, it does have rules that can be counter-intuitive to humans.
- eta_expand 12y agoIn that particular example, the only misleading things are the indentation, and the lack of block delimiting for the inner match. The language grammar is accepted by the grammar compiler bundled with OCaml, which doesn't like ambiguous grammars.
- eta_expand 12y ago> - f*-up licence (open-source, but modifications can only be distributed as source-code patches) I didn't look at the license very closely, but there are a few forks of the language out there (check out github), which aren't distributed as patches.
- edwintorok 12y agoIANAL but I think git makes it pretty clear what is the original software and what are the modifications which seems to be exactly what QPL requires: "distribute your modifications, in a form that is separate from the Software, such as patches."
- tomp 12y agoNope; you can download "master" (or branch) zip from GitHub, which contains the original with modifications, not separate. It's clearly against the licence.
- mapcar 12y agoI understood that at least a part of the larger programming community felt that the non-concurrent GC was limiting its future growth and shopped elsewhere for a production language.