12 ms·
Can you give an example (or link to an example) of either real code or pseudo-code where a there is a reference in a sub-block (sub-module) to both a shadowed v
by malandrew 14y ago
Can you give an example (or link to an example) of either real code or pseudo-code where a there is a reference in a sub-block (sub-module) to both a shadowed variable in that sub-block and also a reference made to the same variable in the parent scope by way of name hash-tables? I'm just curious to see how this is done in practice and some real examples of where a module system that permits access to a shadowed variable proves more useful, flexible and generally more robust.
Also, how does Modula-2 (or Standard ML's) module system enforce contracts beyond what a C/C++ header file offers us? Why does C/C++'s primitive system offer us nothing intellectually?
Lastly, if you were to try adding a more robust module system to a language like JavaScript, how would you go about doing it? (assuming such a thing is possible).