Is there a way to share some secret value across a few modules, and prevent
other modules? f.e. prevent modules of an app dev who is importing modules
of a library where the library wants to share private stuff across its
modules. Is this possible to implement somehow?
WeakMaps can be
Nope. This is exactly why it seems that "protected" couldn't have any way
to work that has "hard" enforcement.
The only true privacy in JS is via closure (including WeakMaps), or via the
upcoming "private fields" proposal, assuming it stays as "hard private".
Anything shared is publicly
2 matches
Mail list logo