Live data from Hacker News

Standard ML in 2020

notes.eatonphil.com

21–30 of 125 posts

Re: Standard ML in 2020

#21

Here is a paper[1] written by Andreas Rossberg, specification author of Web Assembly, that discusses the defects in the definition of Standard ML. I believe he tried to address many of these issues with Alice ML[2]. [1] https://people.mpi-sws.org/~rossberg/papers/sml-defects-2013... [2] https://github.com/aliceml/aliceml

My biggest personal gripe is no nested functors. SML/NJ does support this as an extension but since no other implementation does you effectively can't use it if you want decent performance (that SML/NJ doesn't really give).

I'm also pretty jealous of OCaml's modular implicits, just because it saves you typing the module name before an operator (i.e. MyModule.+ vs just + implied by context).

It also kinda sucks that operator precedence is defined at the module level and cannot be exported. You have to always redefine a library's operator precedence yourself.

Re: Standard ML in 2020

#22
StandardML really hits a nice sweet spot in language design.

The syntax is super-easy to learn (The BNF for the whole fits in a mere 2 pages[0]), but contains a lot of features in that small package. Rather than tacking on functional features (eg, Java with lambdas), these features have been carefully considered and streamlined and include bits like proper tail calls and currying.

You get nice bits like actually sound types (hindley-milner types as Milner was also one of the SML spec authors), generics (way better than typical interfaces), type inference that actually works, and modules (super-powerful encapsulation). Pattern matching in all it's awesomeness is also on display.

SML has an amazing concurrency story (CML is rather like golang channels, but better with better typing and a bit more flexibility) and compilers like PolyML or Mlton are very fast (once again, around the same as golang).

Despite this, the language doesn't have the academic flaws of its descendants like Haskell.

SML isn't a lazy language, so reasoning about performance is much easier than some other functional languages. SML doesn't pretend the world is a pure function. You are free to make functions that have side effects. While most primitives and data structures are immutable by default, they either have mutable variants (eg, vector and array) or can be used as if mutable with refs (something like typesafe pointers without all the reference/dereference bits).

[0] https://cse.buffalo.edu/~regan/cse305/MLBNF.pdf

Re: Standard ML in 2020

#23
post #22

StandardML really hits a nice sweet spot in language design. The syntax is super-easy to learn (The BNF for the whole fits in a mere 2 pages[0]), but contains a lot of features in that small package. Rather than tacking on functional features (eg, Java with lambdas), these features have been carefully considered and streamlined and include bits like proper tail calls and currying. You get nice bits like actually soun…

Have you used CML for any real projects? Very curious to see. I've always used Poly/ML when I wanted parallelism.

Re: Standard ML in 2020

#24
post #22

StandardML really hits a nice sweet spot in language design. The syntax is super-easy to learn (The BNF for the whole fits in a mere 2 pages[0]), but contains a lot of features in that small package. Rather than tacking on functional features (eg, Java with lambdas), these features have been carefully considered and streamlined and include bits like proper tail calls and currying. You get nice bits like actually soun…

> Despite this, the language doesn't have the academic flaws of its descendants like Haskell.

Can you elaborate on what those flaws are?

Re: Standard ML in 2020

#25

Here is a paper[1] written by Andreas Rossberg, specification author of Web Assembly, that discusses the defects in the definition of Standard ML. I believe he tried to address many of these issues with Alice ML[2]. [1] https://people.mpi-sws.org/~rossberg/papers/sml-defects-2013... [2] https://github.com/aliceml/aliceml

My biggest personal gripe is no nested functors. SML/NJ does support this as an extension but since no other implementation does you effectively can't use it if you want decent performance (that SML/NJ doesn't really give). I'm also pretty jealous of OCaml's modular implicits, just because it saves you typing the module name before an operator (i.e. MyModule.+ vs just + implied by context). It also kinda sucks that o…

> I'm also pretty jealous of OCaml's modular implicits,

Have modular implicits already been implemented? I thought they were still trying to figure out the details of the resolution...

Re: Standard ML in 2020

#26
post #25

Earlier quoted context omitted.

My biggest personal gripe is no nested functors. SML/NJ does support this as an extension but since no other implementation does you effectively can't use it if you want decent performance (that SML/NJ doesn't really give). I'm also pretty jealous of OCaml's modular implicits, just because it saves you typing the module name before an operator (i.e. MyModule.+ vs just + implied by context). It also kinda sucks that o…

> I'm also pretty jealous of OCaml's modular implicits, Have modular implicits already been implemented? I thought they were still trying to figure out the details of the resolution...

Ah, well as with most OCaml planned features I gave up on waiting. Maybe they haven't finished this one.

Re: Standard ML in 2020

#27
post #22

StandardML really hits a nice sweet spot in language design. The syntax is super-easy to learn (The BNF for the whole fits in a mere 2 pages[0]), but contains a lot of features in that small package. Rather than tacking on functional features (eg, Java with lambdas), these features have been carefully considered and streamlined and include bits like proper tail calls and currying. You get nice bits like actually soun…

> Despite this, the language doesn't have the academic flaws of its descendants like Haskell. Can you elaborate on what those flaws are?

Reasoning about haskell performance is hard because it is a lazy language and the compiler pulls a lot of tricks. In SML, code is executed in some sense roughly in the order it is written whereas in haskell it is very hard to know when something will be executed.

Re: Standard ML in 2020

#28
post #15

I've recently picked it up, reading "ML for the working programmer". The language is fairly simple, everything just fits. However: 1. Both Vim and Emacs are horribly annoying with their automatic indentation for SML. There is a lot of fighting against the editor in this department. In Emacs e.g. you have to delete whitespace all the time, because otherwise you'd have top-level function definitions shifted 80 characte…

Not a huge fan of ML for the Working Programmer, personally. I'd love to see (or one day write) the equivalent of Practical Common Lisp (which itself needs an update at this point) because MftWP is sooo dated. But I can see how it's a decent enough intro. Regarding your points: 1. Yeah editor support sucks. I normally edit in text mode with my own minimal keyword highlighting or ocaml-mode. 2. Poly/ML can definitely…

2. Good to know. I needed to do a "sudo apt install libpolyml-dev", because otherwise it wouldn't link.

3. Thanks for the tip! That will save me a world of pain.

Re: Standard ML in 2020

#29
post #25

Earlier quoted context omitted.

My biggest personal gripe is no nested functors. SML/NJ does support this as an extension but since no other implementation does you effectively can't use it if you want decent performance (that SML/NJ doesn't really give). I'm also pretty jealous of OCaml's modular implicits, just because it saves you typing the module name before an operator (i.e. MyModule.+ vs just + implied by context). It also kinda sucks that o…

> I'm also pretty jealous of OCaml's modular implicits, Have modular implicits already been implemented? I thought they were still trying to figure out the details of the resolution...

They haven’t been merged. One feature that gives some brevity is type directed constructor disambiguation which allows you to omit the module name when accessing record fields, matching values, or constructing values, provided the type can be inferred in a certain directional way (rather than the more general unification based type inference which is used by the type checker)

Re: Standard ML in 2020

#30
I usually have at least some broad, high level understanding of what tech outside my narrow scope looks like.

Reading the comments here I have zero clue what you're talking about.

Is this what my less technically inclined colleagues feel like when people talk about e.g. machine learning and Python?

Post reply on HN