This is both a comprehensive guide, and an excellent reference! I use it often when writing SML for side projects.
For those interested in parallel, functional programming, I recommend taking a look at Futhark, which leverages data parallelism to make very fast parallel programs. It is based on SML, and has similar syntax, but can automatically build programs that (among other targets) run on the GPU using CUDA or OpenCL. It is also worth checking out MPL, which extends the (already awesome) whole-program optimizing compiler MLton to add support for nested, fork-join parallelism.
Anecdotally, most people use SML as part of academic projects and when they do to use it for commercial projects end up going to Ocaml or Haskell. That is because of the wider ecosystem of projects to support practical things like talking to databases, networking, etc. Also larger communities for documentation and help debugging issues that only come up once you start scaling out.
There are some allusions here I think. The opening line of part 2, "All Standard ML is divided into two parts."
is a very strange English sentence to write. It actually sounds like the very famous opening line of Julius Caesar's "Commentary on the Gallic War" (which is prescribed as a model of Latin composition)
Whenever I see a Standard ML article/paper, it always reminds me that I still need to learn OCaml. Not that one is better than the other, just that I've not gotten around to learning OCaml yet.
Regardless, I would prioritize learning OCaml. The only thing SML has going for it is nicer syntax, and less stapled-on OOP stuff. OCaml's better in almost every way for day-to-day programming.
Not necessarily. E.g. SML has had multicore since forever. In OCaml it’s the hot new thing now, which probably needs some time in the wild before everything is ironed out.
Ok that's interesting, I hadn't realized the multicore story there was better.
Back when I was more into looking at this kind of thing (uh, 20 years ago?) I wrote a few simple programs in SML/NJ and far preferred its syntax to OCaml. But even back then, OCaml had more dev community momentum. (Actually Haskell seemed to have even more momentum but I never ever found it readable or comprehensible as a mere mortal.)
At the time for what I was doing, I really wanted... SML but without a garbage collector, operating for systems level programming. And so I was excited when Graydon Hoare started what became Rust. Which is what I prefer to work in these days.
Still, if I wanted a language for higher level development, I really would prefer to reach for something in the ML family of languages, they are just very expressive. But I wouldn't do this for paid employment work, too esoteric. Maybe that will change a bit now that Rust has brought some concepts and syntax from ML to the mainstream.
SML definitely has a nicer formal definition but OCaml has better performance and a lot more functionalities. I wouldn’t say SML is the better language but the syntax definitely is cleaner.
Strangely I think SML focus on being well defined and tidy is why it never really took off. A language success is linked to its community and your features define who will want to join you. It seems to me that at the beginning it’s better to attract tinkerers than perfectionists.
Past a certain minimal threshold of needed functionality, I prefer a language not to have a couple good features than to have a really bad one, like implementation inheritance, particularly multiple inheritance.
OCaml is a much larger language than SML. SML feels cleaner in some ways. For example, it has overflow checks (or infinite precision) for integer arithmetic. (Although OCaml no longer has writable string literals …)
SML has multiple, mostly independent implementations with different characteristics. Poly/ML had multi-processor support well before OCaml. But OCaml development is certainly much more active.
Though I know far more about SML than OCaml, I would approximate that the former is to C as the latter is to C++.
Which one you learn should depend on what you plan to use it for! I'm partial to SML. Then again, I've only written a handful of real-world programs with it.
ML is notable for its higher-order module system, which solves the same problems but is different than the type classes/protocols/traits of Haskell/Swift/Rust.
I found the initial example of a regex package hard to follow. I don't know the language and am confronted with this example, that makes use of many advanced capabilities of the language.
Instead I looked for a book for beginners in Standard ML and found "Elements of ML Programming" to be quite good.
For those interested in parallel, functional programming, I recommend taking a look at Futhark, which leverages data parallelism to make very fast parallel programs. It is based on SML, and has similar syntax, but can automatically build programs that (among other targets) run on the GPU using CUDA or OpenCL. It is also worth checking out MPL, which extends the (already awesome) whole-program optimizing compiler MLton to add support for nested, fork-join parallelism.
https://github.com/diku-dk/futhark
https://github.com/MPLLang/mpl