> ... in 20 years, the language picked up many language
features that were open research problems in 1995, such as objects and
classes with type inference, polymorphic variants, first-class polymorphism,
and first-class modules.
SML is a much simpler language and I think a solid SML kernel with a good (read: modern, web-friendly) standard library targeting LLVM or the JVM could be a real winner for commercial use.In what way though? The amount of concepts and gotchas you have to understand to be proficient at OCaml is nothing compared to C++ in my opinion. I've used SML as well and didn't find it hugely different from OCaml unlike when I went from C to C++.
I use SML for the JonPRL proof assistant, and I couldn't be happier. Some things would be a bit easier in OCaml, but to be honest, I love the fact that my code will continue to work without modification for decades, due to the simple fact that SML is a language frozen in time.
Unfreeze it, all the extant MLs fall short in one way or another. A modern SML with none of the syntactic cruft of OCaml; the lazy evaluation of Haskell and its non-existent module system; the nutured nature of F# ... that would be ML joy, maybe Rosenberg's 1ML will make that a reality.
We're in the middle ages of computer science language-wise.
Hamlet is a portable SML implementation written in SML.
http://www.mpi-sws.org/~rossberg/hamlet/
(Not unlike SICL, which is a portable Common Lisp for R&D https://github.com/robert-strandh/SICL)
I use SML over OCaml mostly for cultural & political reasons; SML has a few areas ripe for improvement (some of which are addressed in OCaml, others not):
1. structure sharing in the Definition is so bad that pretty much all the implementations of "S"ML diverge from it in some way. Each implementation of structure sharing is frustrating in its own way.
2. would be nice to be able to do higher-kinded polymorphism, as in 1ML
3. would be nice to unify polymorphism as a mere mode-of-use of functors, as in 1ML (well, this was not invented in 1ML, as I first saw it in Dreyer/Harper/Chakravarty's "Modular Type Classes": http://www.mpi-sws.org/~dreyer/papers/mtc/main-long.pdf; it may go back as far as the Harper-Stone type theoretic semantics). Combined with higher-order functors (which I believe are proposed to be added to "Successor ML"), this would give a proper treatment to polymorphism at higher kinds.
4. we need to standardize on a package calculus; the ML Basis system as used in Mlton is pretty nice, as is the simpler system used in SML/NJ's "Compilation Manager".
5. modular type classes (analogous to coq's "canonical structures") should be added in order to alleviate the pain of explicitly instantiating functors, etc. We do NOT want "type class coherence" as in Haskell, which amounts to a piece of global state that essentially outlaws local reasoning. I call it the "Antimodularity Restriction", but the name hasn't caught on, as much as Haskell folks like to berate us over our "value restriction" (which is a non-problem, and very useful--though it would be better to reconstruct it in a less ad-hoc way, via the theory of polarization that comes from Girard, and was further developed in light of effects, refinements and polymorphism by Zeilberger in his dissertation).
6. I'd like to (at least) follow OCaml and add the ability to convert between module signatures & existential types; I'm not sure if I am sold on the 1ML approach, which goes quite a bit further than this, but I need to investigate it more.
7. Refinement types would be nice (but PLEASE---do not fix in advance some awful solver or something for this; contra the popular literature at the moment refinement types have NOTHING at all to do with solvers!).
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." ;)
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).
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.
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.
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.
With the deprecated features of C++, I'm not so sure.