6 ms·
OCaml Language Sucks (2007)
- wyager 11y agoAgree with many of these, but >Cannot add an int to a float - need an explicit cast. This is an obvious deficiency is ridiculous. Implicit conversions cause huge classes of errors in languages that support them. There's not even well-defined behavior for converting an integer that won't fit in the mantissa to a float. My experience with OCaml is that it made too many concessions to imperative programming to be a particularly useful functional language and its type system is sorely lacking. Things like 31/63-bit integers for pointer tagging, binary "generic" comparison operators, ;-sequencing, etc. are terribly ugly hacks.
- ufo 11y agoI agree that the issues you mentioned are annoying warts for Ocaml but I'm not so sure that they are all concessions to imperative programming. The 31-bit ints have more to do with simplifying the garbage collector implementation. The "generic" comparison operators have more to do with the lack of type classes. This has a bit to do with the imperative bits of the language (which make implementing type classes a bit harder) but also has to do with conflics with the existing module system (ocaml Functors support type encapsulation and some other things that make it harder to add type classes to the language)
- iso-8859-1 11y agoPosted to Reddit eight years ago: https://www.reddit.com/r/programming/comments/20dh6/ocaml_language_sucks/ https://www.reddit.com/r/programming/comments/20dh6/ocaml_la...
- pcwalton 11y agoThe rather idiosyncratic language preferences of the author show through at the end: > Make no mistake: Java/C/C++/C#/Perl are much worse than OCaml! There appears to be just one good tool, with OCaml coming a distant second. where "one good tool" links to http://www.podval.org/~sds/tool.html http://www.podval.org/~sds/tool.html, an essay praising Common Lisp.
- wlievens 11y agoDevout Lisp afficianados tend to be a little... opinionated.
- arihant 11y agoIt does not matter how we put it. If one is wrong, they are wrong. If one is "opinionated" and he/she is wrong, they will fail. It hasn't helped Lisp's cause that a majority of its promoters are heavily opinionated.
- pizza 11y agoFrom https://en.wikipedia.org/wiki/Cromwell%27s_rule https://en.wikipedia.org/wiki/Cromwell%27s_rule > If the prior probability assigned to a hypothesis is 0 or 1, then, by Bayes' theorem, the posterior probability (probability of the hypothesis, given the evidence) is forced to be 0 or 1 as well; no evidence, no matter how strong, could have any influence.
- DonaldFisk 11y agoThis is true because Devout ?x aficionados tend to be a little... opinionated. I've met plenty of devout Prolog, C, C++, and Java aficionados, and yes, they're opinionated. Also, you're more likely to notice opinions that differ from your own than ones you agree with, these are more likely to be held by groups you don't belong to, and you're less likely to belong to minority groups, such as Lisp programmers.
- bubtubgub 11y ago> I've met plenty of devout Prolog aficionados No you haven't.
- DonaldFisk 11y agoI can understand your incredulity, but yes, I have. They even called themselves "the Prolog mafia". This was in the early 1990s. I like Prolog, and regret that it's hardly used nowadays.
- Ericson2314 11y agoHaskell -XStrict, problem solved :P.
- vegabook 11y ago..until you need to use somebody's Mensa-level-obfuscated, undocumented, library. Life is too short.
- Ericson2314 11y agoAre you saying that doesn't happen in the OCaml ecosystem?
- vegabook 11y agoyes it does. Fair comment. But Haskell attracts the 1% CS elites who, sadly, are counterproductive to the language's wider adoption. Ocaml is not pure enough for these guys, and so, a paradoxically smaller community produces a higher amount of actually practical stuff that an imperative "dunce" like me can hope to aspire to using. If I may put it another way, Haskell is too beautiful for its own good, because it encourages "art", not engineering.
- Ericson2314 11y agoAs a Haskell User, ....yes I can totally be a non-productive artist, but I can also bite my tongue, disable the language extension, and get shit done too :). Consider from other perspective. Yes there are some pretty crazy libraries out there, but I assure the more (in)famous are indeed used, and used practically by much of the people who do, let's say, work professionally in Haskell. Now maybe that does create an inner-circle trap that impedes broader adaption among developers, but the services/app/executables do get made. The thing that bugs me about OCaml is many of the flaws are just so damn simple-stupid. Not module limitation, but == and friends, let's say (to use things from link). I respect the ML tradition, but I think Rust is going to eat OCaml's lunch on the pedagogy/developer-mind-share front.
- ufo 11y agoSome of these points are a bit outdated. Ocaml improved a lot recently. > False Sense of Security This is a strawman argument. And the static types really do help, specially if you make good use of algebraic data types and the exhaustiveness checker. The autocompletion and documentation suport is also super nice. Installing Merlin is one of my top priorities when I set up an ocaml environment. https://github.com/the-lambda-church/merlin https://github.com/the-lambda-church/merlin > Few Basic Types Nowadays you tend to see tons of different integer types in systems programming languages (C, C++, Rust, etc). This is more the author saying he loves Common Lisp than a downside of Ocaml. > Module Immutability Can't you define a new module that wraps around the old one and overrides the `date_of_string` function? Changing the implementation of a module violates all sorts of abstraction guarantees and would lead to many thorny issues. > Polymorphism Causes Run-time Type Errors Polymorphic equality and comparison can definitely be a source of confusion. Hopefully in the future we will have module implicits and be able to solve this issue similarly to how Haskell does it. > No Macros Again, this is more of a "my language is not LISP" complaint. Ocaml has camlp4, which is not a full-blown macro system but allows for a large variety of syntactic extensions to the language. However, camlp4 was tricky to maintain in sync with the original language so nowadays the community is moving towards simpler ppx transformers: http://whitequark.org/blog/2014/04/16/a-guide-to-extension-points-in-ocaml/ http://whitequark.org/blog/2014/04/16/a-guide-to-extension-p... > Record field naming hell This got much better in more recent Ocaml versions, which let you have multiple records with the same field name living in harmony. > Syntax I'll have to agree with this one. Ocaml definitely doesn't have the prettiest syntax. > No (ad-hoc) Polymorphism This is a price to pay for keeping the type system sane. More flexible arithmetic coercion rules would also get in the way of type inference, which is a really nice thing about Ocaml. > Inconsistent function sets Its a bit less awful if you use one of the "replacement standard libraries", such as Containers, Core or Batteries. But yes, the suckyness of the standard library is a huge pain point. > Arithmetic's readability I don't think defining custom operators is as bad as the author thinks here. Their precedence is defined by the symbols you use so a new multiplication operators should behave similar to all the other ones. But yes, the monomorphic operators really are annoying. As I said before, I'm really looking forward to module implicits (sadly, it seems we'll have to wait at least until the version after the next one though) > Order of evaluation This one is even worse than he says. Order of evaluation is undefined and when compiling to bytecode its different from when its compiled to native code (one is left-to-right and the other is right-to-left) > No implicit forward declarations Being able to shadow existing definitions is pretty nice sometimes. Haskell does the "declarations are recursive by default" thing and it sometimes gets in the way. > Standard Library Sucks Can't argue against that. But at least there are replacement libs you can use to make it suck a little bit less. > OMake Nowadays I think people are moving towards ocamlbuild instead.
- chmaynard 11y agoA very enjoyable read! The author sounds like a curmudgeon of the first order. Unfortunately, my only take-away after exploring his website is the joke about the pessimist.