Live data from Hacker News

Standard ML in 2020

notes.eatonphil.com

11–20 of 125 posts

Re: Standard ML in 2020

#11
post #10

Which SML implementation has the best editor tooling? The article mentions that certain SML implementations have seen better support for parallel and concurrent programming than OCaml, but Merlin and ocamlformat for OCaml are great as far IDE tooling go. Which SML implementation has the best tooling for things like go to definition, reveal type at cursor, and format file?

None of them have invested very much in tooling as far as I know. There are some small sml-modes for emacs or plugins for vim but they only do basic syntax highlighting.

One of the biggest missing things for SML tooling is parsers for SML written in SML. They tend to be written in the implementation language and not exposed as a library. So you don't see SML formatters or documentation generators so much.

There have been a few attempts at this but they haven't seriously caught on.

Re: Standard ML in 2020

#12
I'd no knowledge of SML until I came across the Programming Languages course by Washington Uni on Coursera. I tried learning Scala first but then never got anywhere. This course was amazing. Unfortunately, didn't have enough time to dedicate to it. Thanks to this post, I'm excited to try again. :)

Re: Standard ML in 2020

#13

I used Standard ML for a research project in college and really fell in love with it. Yes, at times it feels a bit old, but nothing felt bad . One of the creators of Standard ML (Harper, I think) wrote a really beautiful textbook, Introduction to Programming in Standard ML, which I think is the best textbook on programing I've ever come across. I'm glad that Standard ML is still kicking.

ML for the Working Programmer is an awesome textbook to use to learn programming. It is free to download on the author's website:

https://www.cl.cam.ac.uk/~lp15/MLbook/pub-details.html

Re: Standard ML in 2020

#14

Earlier quoted context omitted.

Not totally sure, but it's definitely not as active as the first three I mentioned. The last commit is from over a year ago [0]. Although the SML/NJ website shows releases presumably from 2020. [0] https://github.com/sml-nj/smlnj

There is a lot of active development going on in their SVN repository http://smlnj-gforge.cs.uchicago.edu/scm/viewvc.php/?root=sml...

yeah, that svn->git conversion was a one-time thing, and not fully kept in sync automatically.

A bit unfortunate as recent releases have fixed one of the main for smlnj/reasons to use other compilers in that it now supports x86-64.

Re: Standard ML in 2020

#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 characters to the right.

2. I've used Poly/ML and SML/NJ so far. Both of them are purely interactive, meaning I can't just compile a program into ELF and ship it somewhere else without the compiler. That makes it a no-go for me for real-world use.

3. The interactive modes of Poly/ML and SML/NJ don't support readline shortcuts. They are the most cumbersome REPLs I've ever used.

4. Inline type declarations (as opposed to Haskell-style type declarations on a separate line) are very noisy - they make reading the code harder. Omitting them (which is the rule in SML in practice) leads to hard-to-decipher compilation errors when you write a new piece of code and you made an error somewhere which confused the type-inference about your intentions. Suddenly forgetting about a word or a set of parentheses in one function results in errors in another perfectly-good function. It's the horror of C++ templates all over again.

Re: Standard ML in 2020

#16
post #14

Earlier quoted context omitted.

There is a lot of active development going on in their SVN repository http://smlnj-gforge.cs.uchicago.edu/scm/viewvc.php/?root=sml...

yeah, that svn->git conversion was a one-time thing, and not fully kept in sync automatically. A bit unfortunate as recent releases have fixed one of the main for smlnj/reasons to use other compilers in that it now supports x86-64.

Thanks all! Updated with SML/NJ in the major list again too.

Re: Standard ML in 2020

#17
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 generate binaries! Most distros ship with `polyc` that will build the binary for you. But this is just a shell script around opening the REPL and calling some dump image function (like how you build a binary on SBCL). MLton and Poly/ML definitely allow you to build binaries. I don't know about SML/NJ.

3. For sure a pain. I use rlwrap [0] to work around this, which is ultimately simple enough!

4. Interesting! I personally find Haskell-style decorations so much more a pain since they're not inline. SML is very much like other major languages in the way it does inline types (TypeScript, Go, C#, etc.).

[0] https://github.com/hanslub42/rlwrap

Re: Standard ML in 2020

#19
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

Re: Standard ML in 2020

#20

As someone reasonably versed in OCaml but knows nothing about SML, what are primary differences? Given that OCaml has much better tooling and more of a community, what draws people to SML still?

SML’s compilers and implementations are state of the art. Advanced optimizing compilers and multicore are already huge differentiators.

Also, Standard ML is, well, standardized. The standard isn’t perfect but it at least allows for a strong ecosystem of independent implementations.

Post reply on HN