2 ms·
The good part of encapsulation is separating interface from implementation: you can publish a data type without giving access to its innards. And you can do th
by silentbicycle 18y ago
The good part of encapsulation is separating interface from implementation: you can publish a data type without giving access to its innards.
And you can do that in a good module system, too. Look at OCaml's. (http://caml.inria.fr/pub/docs/manual-ocaml/manual004.html http://caml.inria.fr/pub/docs/manual-ocaml/manual004.html)
Also, look at the functors - modules are first class, so you can write functions that take a module and return a (usually more specific or generated) module.