Re:Implementing Private Fields for JavaScript
by ssdspoimdsjvv on Sunday June 13, 2021 @05:56AM
(#27491240)
One more reason to just use Typescript.
[ Parent
| on HN ]
Re:Implementing Private Fields for JavaScript
by andy_ppp on Sunday June 13, 2021 @06:21AM
(#27491350)
Variables are never truly private in the compiled JS though. You can fake it using clever closure techniques but there are still ways to access the vars as I understand it. This is fixing that at the JS level.
Re:Implementing Private Fields for JavaScript
by tylerhou on Sunday June 13, 2021 @06:57AM
(#27491534)
I don’t know of any way of accessing lexically bound variables that are captured by a closure if there is no explicit getter.
Re:Implementing Private Fields for JavaScript
by throw_m239339 on Sunday June 13, 2021 @09:07PM
(#27498219)
Typescript is a mostly superset of javascript. Typescript does/will also support # for private fields so it changes absolutely nothing.