|
|
|
|
|
by k_sze
2437 days ago
|
|
Another thing that I would like to see in some kind of strict mode is the ability to mark explicit exports like in JavaScript modules. I often want to import multiple things globally at the top of a module because they are shared by multiple class or function definitions that I am writing. However, such imports end up being exposed to and usable by the consumers of my module, even though the consumers should really have imported those things at their source instead of via my module. There are currently maybe two ways to tackle this “problem”, without a strict mode: 1. Don’t import at the global module scope; but that’s a bit tedious. 2. Import with rename, like `import os as _os`, and then leave it to the principle of “we’re all consenting adults”. I.e. if anybody imports and used things that start with an underscore, it’s clearly their fault, not mine. |
|
[1] https://en.wikipedia.org/wiki/Law_of_Demeter