What's a module? I've read more than once that “language X doesn't have real modules”. Is there an academic definition? If not can you point me to the discussion? I remember I read somewhere that “only SML has real modules” 🤔
Conversation
Harper and Peirce define a module informally as, “A collection of components, which may include procedure of function definitions, variable declarations, type definitions, an initialisation code – specifics will vary from one language to another.”
1
4
More information on their perspective can be found in “Design Concepts for ML-style Module Systems”, a chapter in Advanced Topics in Types and Programming Languages.
1
3
“only SML has real modules” – I think this is a pretty extreme and lazy position to take. SML has a pretty expressive module system but yeah, there's a wide diversity in different module systems, and different definitions.
1
5
I'm guessing by that they are more saying “Language X has the best module system I am aware of, under my definition of ‘module’”.
1
4
One interesting case of modules in the ML sense is Scala, for instance, which merges them with the object system, while retaining lots of stuff from ML, like module functions and associated types etc.
1
4
Why3 is also interesting - you never write module types, you clone new instances modules and fill in/add definitions. It looks a bit more like prototype based programming I think? (using that term loosely) why3.lri.fr/doc/syntaxref.
Also worth looking at 1ML for another take on ML-style modules – this time emphasising first-class modules, and removing the destinction between the module language and the term language: people.mpi-sws.org/~rossberg/1ml/
1
3
Also might be worth looking at Modula-2 as well! Ecmascript has interesting modules too, based on JS objects? Maybe algebraic specification languages too – I think ML drew inspiration from those?
1
4
Show replies

