148 points · by swatson741 · 1y ago · 49 comments
Back in the day when I played with these things I preferred SML/NJ over OCaml, but OCaml "won" the battle for headspace.
I'd consider using OCaml for new projects, I really like the language family.
OTOH some of the choices it makes are a bit more pragmatic - e.g. arithmetic is overloaded for ints and floats, locals can be marked as mutable similar to record fields, and fields are scoped to record types (so different types can use the same field name).
Edit: Obviously, F# is the step-sibling here, given its half-dotnet parentage. However, they’re all solid choices. Their spectacular type inference makes coding in them a very gratifying experience. I can only think of TypeScript as the closest to them among the more popular modern languages.
It's probably their lesser known volume, but IMHO it makes a terrific job at teaching the ML family and its features.
Also, I think Rust would consider itself to be a mainstream language, though they aren't techically "making this switch" because the language has always been expresion oriented from the outset. The Book has about two paragraphs about the statements in the language and then a whole chapter on expressions because almost everything is an expression.
I strongly believe that - although my home institution no longer teaches an ML as first language - this is the best way to teach CS to undergraduates. An ML has all the fundamental ideas you will need to also teach about this discipline, and (so long as you choose e.g. SML/NJ or similar, not Rust or something) it won't be a language the average teenager you recruited might already know, so the week 1 exercise showing they've understood what they're doing is actually work for all of your students, averting a scenario where some of them drift away only to realise at exam time that they haven't learned a thing.
Standard ML was my go-to language for many years.
I always found SML/NJ complicated both to compile and use, compared to...
...well, pretty much every other compiler: Moscow ML, Poly/ML, MLton, MLKit.
That said, it’s the OG so I give it some slack. I did enjoy MLton though, but it’s easier to do when the instructor wrote it.
It would have been fun if they had renamed to JSON instead of Exxon.
Datatypes are just ok. Classes would be better. It's sort of strange to represent lists (and everything else) as enumerations. It's not really essential or fundamental but I guess that's what Lisp is for.
Really enjoyed it.