Rendered at 04:08:49 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
hutao 49 minutes ago [-]
I've always felt that ML hit the sweet spot between functional and imperative programming. It affords conveniences such as algebraic data types and first-class functions, but unlike Haskell, it doesn't require monadic programming to use IO or mutable references.
ML also has an interesting module system, which achieves similar goals as object-oriented programming, but in a very different way. While mainstream "class-based" OOP identifies the data type with the unit of encapsulation, ML has "modules," which are separate entities from types, and which may both define types and values as members. However, a downside of this approach is that you sacrifice late binding, as the module language and "core" language are stratified into different layers. Instead, dependency injection is achieved through module-level functions, called functors,
A lesser-known fact is that ML originated as the scripting language for the LCF proof assistant (which is where the name "ML," or meta language, comes from). In the LCF tradition, the inferences rules of the logic are implemented in a trusted kernel, then clients use those inference rules to write tactic scripts that construct theorem objects. This design was supported by ML's module system: theorems were defined as an abstract type in a "kernel" module, and the inference rules were defined as functions inside the module. Here is a tutorial that explains the LCF design better than I can: https://www.cs.cmu.edu/~fp/courses/15317-f17/recitations/rec...
porcoda 4 hours ago [-]
For those interested in the Standard ML compilers, Mlton is another one worth checking out. Standard ML of New Jersey (smlnj) is another interesting one although it tends to be more of a research vehicle than polyml or mlton. If you are inclined toward verification, the cakeml project is quite cool as well. For those unfamiliar with standard ML, if you’ve heard of ocaml or F#, they’re relatives in the ML language family.
wk_end 2 hours ago [-]
> Standard ML of New Jersey (smlnj) is another interesting one although it tends to be more of a research vehicle than polyml or mlton.
This is interesting! My impression was that SML/NJ was the de facto "standard" Standard ML implementation (maybe analogous to SBCL in the Lisp world), and (FWIW) Gemini agrees, describing it as "the oldest and most widely used". So I'm surprised to see someone stick it in the rear behind Poly/ML and MLton.
I don't really know what to make of that, except that I guess there's a surprisingly vibrant SML ecosystem and don't listen to any one person (myself included) about it: try them all and see which SML implementation is right for you :)
porcoda 1 hours ago [-]
I think mlton is the one to reach for if you want strict conformance to the SML'97 definition [1]. There's a page on the MLton site that describes where SMLNJ deviates from SML'97 [2].
I'm surprised Gemini says SML/NJ its the most widely used. I've been an active Standard ML user for close to 30 years, and while that was certainly true for the first half of that time, I found most projects around me drifted to defaulting to want to compile with mlton or polyml. SML/NJ's heap2exec was a bit clunky compared to the others. It's great that they're slowly moving it over to LLVM.
"Standard ML is a functional programming language, in the sense that the
full power of mathematical functions is present." From a Pdf linked on the repo (I didn't know what Standard ML was, I was hoping for a mark up language)
ptrott2017 2 hours ago [-]
StandardML is a rather nice modular high level functional programming language with algebraic datatypes, pattern matching, compile-time type checking and type inference etc. Poly/ML extends this with strong proven multi-core and cross platform support including Posix threads, parallel garbage collection, FFI etc. Poly/ML has been around a while, but it is still actively maintained by Dave Mathews et al (most recent release June 2026) has good windows and X11 support. Poly/ML is a great way to explore the world of StandardML and is used to build Isabelle and HOL theorem provers. Definitely worth a look!
ML also has an interesting module system, which achieves similar goals as object-oriented programming, but in a very different way. While mainstream "class-based" OOP identifies the data type with the unit of encapsulation, ML has "modules," which are separate entities from types, and which may both define types and values as members. However, a downside of this approach is that you sacrifice late binding, as the module language and "core" language are stratified into different layers. Instead, dependency injection is achieved through module-level functions, called functors,
A lesser-known fact is that ML originated as the scripting language for the LCF proof assistant (which is where the name "ML," or meta language, comes from). In the LCF tradition, the inferences rules of the logic are implemented in a trusted kernel, then clients use those inference rules to write tactic scripts that construct theorem objects. This design was supported by ML's module system: theorems were defined as an abstract type in a "kernel" module, and the inference rules were defined as functions inside the module. Here is a tutorial that explains the LCF design better than I can: https://www.cs.cmu.edu/~fp/courses/15317-f17/recitations/rec...
This is interesting! My impression was that SML/NJ was the de facto "standard" Standard ML implementation (maybe analogous to SBCL in the Lisp world), and (FWIW) Gemini agrees, describing it as "the oldest and most widely used". So I'm surprised to see someone stick it in the rear behind Poly/ML and MLton.
I don't really know what to make of that, except that I guess there's a surprisingly vibrant SML ecosystem and don't listen to any one person (myself included) about it: try them all and see which SML implementation is right for you :)
I'm surprised Gemini says SML/NJ its the most widely used. I've been an active Standard ML user for close to 30 years, and while that was certainly true for the first half of that time, I found most projects around me drifted to defaulting to want to compile with mlton or polyml. SML/NJ's heap2exec was a bit clunky compared to the others. It's great that they're slowly moving it over to LLVM.
[1] http://www.mlton.org/Features
[2] http://mlton.org/guide/20051202/SMLNJDeviations