Hacker News new | ask | show | jobs
by humzashahid98 758 days ago
Standard ML is pretty simple and easy to pick up, but a weak point is the lack of { record with updatedValue } syntax to create a new record which is the same as an existing one but with some value changed. You have to specify every field in the record which can be a pain depending on how large your record is.

Standard ML has some nice features though and I think what I mentioned is the only serious shortcoming (except for ecosystem if that's important to you).

Standard ML is also structurally (but strongly) typed, unlike F# and the vast majority of nominally typed languages, which is rare but nice.

type person = { age : int, name : string }

is the same as the type

type animal = { age : int, name = string }

but this hasn't been an issue foe me, and structural typing means you can avoid defining the type at all which is convenient for small records.

For example, a function to increment age has no need for you to define the type.

fun grow { name, age } = { name = name, age = age + 1 }

I think Standard ML helps you understand the origin of some common FP idioms. Like tuples are really just records and SML treats them as such. The empty record {} is the same as the empty tuple (): both are the unit type. And a record like { 1 : "a", 2 : "b" } is exactly the same as the tuple ("a", "b").