Hacker News new | ask | show | jobs
by catnaroek 3189 days ago
The meaning of “module” is pretty concrete and specific. A module is:

(0) A unit of encapsulation: Modules can export abstract types whose representation is hidden from the rest of the program.

(1) A unit of type-checking: Modules can be type-checked without knowing anything other than the interface of their dependencies.

(2) A unit of translation: Modules can be translated to target machine code separately from each other. (That being said, whole-program compilation is fine if you want it. The semantics of the module system shouldn't make it mandatory, though.)

Most programming languages don't have module systems at all. And most programming languages that do have module systems, have module systems that suck. Including Rust.