3 ms·
A while back, I had to decide which of SML or Ocaml I'd recommend to people interested. I looked up comparisons hopefully from talented developers. Found this o
by nickpsecurity 11y ago
A while back, I had to decide which of SML or Ocaml I'd recommend to people interested. I looked up comparisons hopefully from talented developers. Found this one by Chlipala:
http://adam.chlipala.net/mlcomp/ http://adam.chlipala.net/mlcomp/
A C and C++ analogy doesn't make sense unless you really cherry-picking. A better analogy would be Wirth's original Pascal for classrooms vs Borland's Turbo Pascal (or Free Pascal): one is designed to get stuff done with syntax and semantic features that make a lot more sense. You can use Ocaml in a style that gets you much benefits of ML. Even Coq extracts to a minimal Ocaml. Or, you can go Jane St with it developing real-world applications with excellent properties that neither SML nor C++ would have in current state.
Talking like Ocaml is ML's C++ is an insult to them. C++ is garbage built on worse garbage to make the landfill smell less. You'll find plenty of C++ developers admitting they only use it because they have to for whatever reason. You don't see that with Ocaml: good design, tools, and community are driving much growth and happy developers. So, it's more "Ocaml: ML Go's Pro" rather than "C++: Bend Over, Here it Comes Again." ;)
- mercurial 11y agoI'd characterize OCaml's tools as a mixture of best-of-breed (Merlin, OPAM) and oh-my-god (build tools, debugger). The language itself, if you avert your eyes from the standard library, is pretty damn good though.
- nickpsecurity 11y agoThat matches the view others have shared with me. A few of them mentioned that Jane St re-wrote the standard library to try to fix that problem. They also gave it back to the community. Have you tried theirs? If not, take a look at it so you can tell us if you think they've gotten past that weakness. https://janestreet.github.io/ https://janestreet.github.io/
- mercurial 11y agoThere are least three competing standard libraries: Jane Street's Core (high-quality but fairly big, also generates large binaries due to OCaml's lack of good dead code elimination support), Batteries (older, developed by the community), and Containers (Simon Cruanes' project, mostly - smaller but very well-designed). They all have their advantages, the issue is that there is no one true alternative standard library, which makes the life of library writers difficult (especially when you want to use a type in your interface that is only present in one of these libraries).
- nickpsecurity 11y agoI see the problem. Wouldn't this happen if SML was industrialized to any degree by different players? Back to Ocaml, what would your proposal be to deal with this aside from adding dead code elimination for Core? That would be my first strategy because Ocaml needs it anyway.
- mercurial 11y agoI think it's difficult to tell people to jettison their stdlib dependencies by now (I think OPAM reverse dependencies are about 50/50 between Core and Batteries). What I'd like to see is at least common data structures for useful things (like time) in the standard stdlib, and hooks for nice things like gen/seq (other high-qualities-but-very-lightweight libraries from the author of Containers).
- nickpsecurity 11y agoIt might be difficult but it needs a strong, standard lib. I can't remember that many languages that really made it with several competing libraries for the basics. Could go Common LISP approach and do an integration but that would probably be similarly ugly. A LCD approach with stuff like you suggested might work. Maybe source-to-source translation from one to the other. (shrugs) Still think fragmentation might hold them back.
- eatonphil 11y agoI think Rossberg's (author of 1ML) comparison[0] might be more appropriate because it doesn't make assumptions about what is better or worse in a language - whereas Chlipala's comparison makes a lot of assumptions. I personally don't think a lot of the assumptions he makes are valid especially when languages that are still "popular" and in-use today (C, Go) have features that he would seem to call "academic" rather than professional. My point being, it's not that simple. Though I will grant that the libraries and existence(!) of an OCaml community is good reason to select OCaml over SML. [0] https://www.mpi-sws.org/~rossberg/sml-vs-ocaml.html https://www.mpi-sws.org/~rossberg/sml-vs-ocaml.html
- nickpsecurity 11y agoThat is a more thorough comparison. Makes deciding the victor a bit more difficult at language level except to say that there's more similarities than differences. As you said, libraries and community are main deciding point for me if I have to recommend a ML. However, I do like that ML has a certifying compiler (FLINT). Love to see one for Ocaml for use in critical tools. The Esterel SCADE code generator, done in Ocaml, was manually verified to object code. That and FLINT make me hope it can be done with reasonable effort with Ocaml.