Re:Is it safe to use __secret_internals_do_not_use_or_you_wi...
by MaulingMonkey on Thursday February 03, 2022 @12:14PM
(#30195244)
Ancient vanilla JS can accomplish similar by using wrapper functions.
However, there's always caveats where language level access controls don't let you quite express the access restriction you want. Perhaps you want to expose something to other official modules from the same constillation of libraries, for example (meaning you wouldn't be able to use Go's "internal"), without comitting to supporting the semver contract for any other arbitrary user of your API (meaning you might resort to similarly scary names.)
[ Parent
| on HN ]
Re:Is it safe to use __secret_internals_do_not_use_or_you_wi...
by udbhavs on Thursday February 03, 2022 @02:02PM
(#30197042)
Private properties in JS classes are syntactic sugar that compile to variable definitions like this in the object's scope
Re:Is it safe to use __secret_internals_do_not_use_or_you_wi...
by ______-_-______ on Thursday February 03, 2022 @01:41PM
(#30196698)
iirc, react-dom (a separate package) needs to access that property as well, which is why it's exposed in the first place