A Crash Course on ML Modules

4 comments · 100% upvoted · source · other discussions

comments

f2u

In a lot of languages modules are clearly a bolted on construction.

Modules were bolted onto Standard ML, too. They are not first-class values. There is no escape hatch from the core language to the module language: You can define types nested in an expression, but not structures, and you cannot apply functors either. The ability to redefine top-level names also means that the order in which definitions are evaluated influences the meaning of the program. This is bad for separate compilation (and there is not even a clear way to map top-level structures and signatures to files).

_lindig

Andreas Rossberg's talk about the (as he calls them) 2.5 languages (core, module, type) of ML and his proposal 1ML to unify them helps to see the different concepts.

https://www.youtube.com/watch?v=yLdOmi2zqVk

lambda_foo [OP]

Very interesting idea, there's some more work here 1ml

[deleted]

article says

generative functors (ala SML) are good for impure code, but applicative functors (ala OCaml and BackPack) really shine with pure code.

but

For you SML fans, OCaml now has generative in addition to applicative functors.

as https://blogs.janestreet.com/ocaml-4-02-everything-else/ explains