Readit News logoReadit News
yaseer · 3 years ago
Cool project!

I always thought SML was a great language for teaching computer science and functional programming.

A lot more fun than learning Java. With ML, you got glimpses of aesthetic beauty in code.

mark_undoio · 3 years ago
I enjoyed my university learning of SML a lot less than I think I should have done. Coming back to it later I was really impressed.

Before university I'd programmed (primarily in BASIC) for many years, so imperative programming just made sense to me. Functional programming seemed alien and the amazing type system of ML-like languages just seemed to get in my way.

What I was missing was the context to understand why it was good. And, to be honest, some compelling examples - we almost completely glossed over IO and system interfaces and the gyrations required to do things like efficient iteration just seemed a bit pointless.

It was good computer science but I found it to be very unsatisfying engineering as I couldn't see how to build something useful. This may be my fault for not doing an engineering degree ;-)

Once I understood more of how these systems are built at lower levels I was much better equipped to be impressed by how much of that was hidden from view!

yaseer · 3 years ago
I also didn't know how to apply the concepts at the time, it seemed more academic than practical, but I had a different level of enjoyment.

Having been a script kiddie teenager, just hacking together stuff that worked, functional programming seemed like some beautiful alien artifact.

I didn't really understand it, but it seemed elegant and enigmatic, which made me want to learn more.

wink · 3 years ago
Same thing here (but with Ocaml). You come into this intro course as someone who can already program and it feels like such a weird take that they deliberately steer you away from playing around and building something cool. IO being important is a hill I'm willing to die on, at least for certain kinds of learners.
westurner · 3 years ago
The bricklayer IDE and bricklayer-lite are SML IDEs FWIU [1]. Could Millet and/or three Millet VSCode extension and/or the SML/NJ Jupyter kernel [2] be useful for creating executable books [3][4] for learning?

[1] https://bricklayer.org/level-1/ :

> Bricklayer libraries provide support for creating 2D and 3D block-based artifacts. Problem-solving and math are used to exercise creative and artistic skills in a fun and innovative environment. Bricklayer integrates with third-party software including: LEGO Digital Designer, LDraw, Minecraft, and 3D Builder (LeoCAD; `dnf install -y leocad`)

[2] https://github.com/matsubara0507/simple-ismlnj

[3] https://github.com/executablebooks

[4] https://executablebooks.org/en/latest/ (Jupyter-Book: Sphinx (Docutils (.rst ReStructuredText), .md)), MyST-Parser (.md MyST Markdown), Jupyter Kernels (.ipynb Jupyter Notebooks),)

agumonkey · 3 years ago
sml was the only one that shadowed lisp in my heart
cannam · 3 years ago
Well! This is interesting. I like the write-up.

The acknowledgements include "Project Savanna, a group who shares my desire in improving the tooling around SML", with a link to a Slack page that asks for a login. Can you say anything more about this project?

azdavis · 3 years ago
It’s a group of mostly current/former CMU 15-150 TAs working on various SML tools, like:

https://github.com/brandonspark/mulligan

https://github.com/T-Brick/molasses

https://github.com/shwestrick/parse-sml

shpongled · 3 years ago
This is awesome, I will be installing and trying out later today!

I was working on a SML compiler [1] and language server in Rust as well, but I dropped the ball towards the end of 2020 as I had a PhD to finish!

SML is a great language, and I think some better tooling (like a language server) is all that it really needs to be useful.

[1] https://github.com/SomewhatML/sml-compiler

sideeffffect · 3 years ago
SML comes with many implementations/compilers, but it is one standardized language (with formalized and verified semantics, IIRC).

Does that mean that there is one repository with modules (like PyPI or Maven Central) which all the implementations can use? Is there even a single build tool that can work with all (or at least some) of them (like Maven, etc.)?

nextaccountic · 3 years ago
> it is one standardized language (with formalized and verified semantics, IIRC).

Unfortunately the spec defines too little, and there are large deviations between implementations. See

http://mlton.org/StandardMLPortability

http://mlton.org/UnresolvedBugs

http://mlton.org/SMLNJDeviations

SML/NJ is the most used implementation afaik. mlton is a whole-program optimizing compiler

lpedrosa · 3 years ago
I think there was something like a package manager.

Tbh, I wish we lived in an alternative reality where SML won over JS and we had it running on every major browser.

Munksgaard · 3 years ago
SML can run in every major browser: http://www.smlserver.org/smltojs/

Interestingly, SMLtoJs predates Elm and PureScript, but never really caught on.

azdavis · 3 years ago
azdavis · 3 years ago
Author here, hope you like it!
cwzwarich · 3 years ago
You're reusing some components from rust-analyzer, so is there any reason you didn't go with a more query-based/demand-driven architecture, e.g. by also using salsa?
azdavis · 3 years ago
Just to make the MVP simpler.

I note in the caveats that the current approach is to recompute everything whenever even one file is changed. But that’s probably not sustainable, as I admit myself in https://azdavis.net/posts/pl-idea-tooling/ :

> As an example, it would be unsustainable if, every time we changed a single function’s body, the language server had to re-typecheck the entire codebase. This might work for an initial proof-of-concept on a small codebase, but for large ones, the responsiveness of the language server would drop precipitously.

If I get around to addressing this, I’d probably use salsa and/or follow along this post: https://rust-analyzer.github.io//blog/2020/07/20/three-archi...

lpedrosa · 3 years ago
This is great. I wanted to create something like this for quite some time! I definitely try it.

Well done!

hajile · 3 years ago
A great language in need of a bit of tooling love. This is awesome!!
mattpallissard · 3 years ago
Awesome. I would have loved to have had this when I learned SML by running through Okasaki's "Purely Functional Datastructures".

The type system and compiler eventually beat me into submission, but an LSP would have probably eased me into it.

I highly recommend that book by the way.

bstpierre · 3 years ago
I had a similar experience with “ Modern Compiler Implementation in ML”… but I didn’t slog through it, I switched to ocaml and ported everything as I went. I’m sure an LSP would have been helpful.

https://www.cs.princeton.edu/~appel/modern/ml

pharmakom · 3 years ago
Very cool!

Is anyone using SML these days for major projects? Feels like all the hype is around F# and OCaml.

magpi3 · 3 years ago
I was introduced to SML in 1996. It has always been a very interesting language, but it never seemed to make it out of academia, which I guess is okay. It seems to have a very nice niche there.
gnufx · 3 years ago
It's at least still used where it originated in proof systems, like Isabelle (as used, for example, in hardware verification work like https://www.lightbluetouchpaper.org/2022/07/22/formal-cheri/ for indirect industrial relevance).