3 ms·
For me, this is of interest: Austral’s module system is inspired by those of Ada, Modula-2, and Standard ML, with the restriction that there are no generi
by jll29 3y ago
For me, this is of interest:
Austral’s module system is inspired by those of Ada, Modula-2, and Standard ML,
with the restriction that there are no generic modules (as in Ada or Modula-3)
or functors (as in Standard ML or OCaml), that is: all modules are first-order.
Modules are given explicit names and are not tied to any particular file system
structure. Modules are split in two textual parts (effectively two files), a
module interface and a module body, with strict separation between the two. The
declarations in the module interface file are accessible from without, and the
declarations in the module body file are private.
Crucially, a module A that depends on a module B can be typechecked when the
compiler only has access to the interface file of module B. That is: modules
can be typechecked against each other before being implemented. This allows
system interfaces to be designed up-front, and implemented in parallel.
It was a mistake how C++, Java and other languages forgot to split interface declaration from implementation definition, IMHO. Good to see that Austral learned from Modula-2.
Before I can form an opinion regarding Austral, though, I would need to see some larger programs implemented in it, for instance some low-level systems code, a generic data structure, some high-level business logic.
- meindnoch 3y ago>It was a mistake how C++, Java and other languages forgot to split interface declaration from implementation definition Huh? C++ is split into header files (interface) and cpp files (implementation)...
- sk0g 3y agoI guess there is no "strict separation" in C++, since that mechanism is, I believe, optional. Adding implementations to your header files might never pass PRs, but still. It does enable header-only libraries though.
- creata 3y agoBut there's no .cpp file for many (most?) uses of templates.
- meindnoch 3y agoIf you think about what templates are, it's not hard to understand why they must go completely in the header files. It's literally a source code template. It's a set of instructions to generate code at compile time, depending on the template parameters, hence 100% of the source code must be available at the point of instantiation. Just the interface is not enough.
- creata 3y agoOf course, but it still breaks the split between interface and implementation that people are talking about here.