4 ms·
Claims 3 and 6 lack a true understanding of Ocaml. The compiler's error messages are exceptionally good in most cases. Syntax errors without detail are a produ
by Yttrill 14y ago
Claims 3 and 6 lack a true understanding of Ocaml. The compiler's error messages are exceptionally good in most cases.
Syntax errors without detail are a product of the parsing technology: its a minor irritant and worst.
The most difficult problem (IMHO) comes from type inference when a type inferred from context is not the one intended, but a conflict is not discovered until code with the intended typing is found: the error reflects the second location which is confusing because there is no error at that point. Of course this doesn't occur if you actually provide type annotations, so it is merely a cost of being able to omit them.
The excess exception handling is a reasonable comment, however it is easy to wrap the exception throwing code in a variant to enforce local error checking, and in any case this style is a property of the library, not the core language.
The type polymorphism in Ocaml is anything but clunky: for basic stuff you don't even need any type annotations. The thing is that Set us NOT type polymorphism. Its module polymorphic, and that requires explicit binding of an instance. There is a simple enough reason: module functors take non-type arguments, particularly function closures, which are values, which do not have unique signatures, so implicit instantiation is not possible.
Ocaml does have some other serious disadvantages. One is that because of the way the optimiser uses information from compiles on which it depends, there are annoying constraints on build order. In addition, recursion cannot span compilation boundaries which is pretty lame for a functional programming language: even C has no problem with that.
Finally, the political situation is probably the biggest problem. The development team is excellent but limited and their focus is on the type system, rather than libraries. Because the community is modest compared to say C++, many attempts to make extended libraries have failed to gain acceptance, because no one wants to depend on an unresourced third party library and the core INRIA team doesn't have the resources or interest to extend the standard distribution.
Despite these difficulties .. I would never want to go back to writing C++ (OMG .. the pain!). As a language .. Ocaml is light years ahead.
- jahewson 14y ago> Syntax errors without detail are a product of the parsing technology: its a minor irritant and worst. You may think so, but it infuriates me many times a day. This is the most basic thing which a compiler should be getting right, and yet they fail. I agree with you on type inference errors, but my solution is to annotate function parameters, which avoids the most confusing problems. I don't want to wrap my error handling code, or work around it with other libraries, I just want something usable out of the box. Languages need to be evaluated holistically, and the design of the standard library is a critical part of that, look at the C++ STL. Yes, I meant module polymorphism. I much prefer the way that F# deals with Sets, Maps, etc. I think Ocaml has had a good run, but it's starting to look dated, F# has really innovated, it's just a shame that it's tied to .NET.