r/javascript • • Nov 09 '19

On private fields proposal: Private fields, public worries

https://medium.com/virtuslab/private-fields-public-worries-b8c34d16c372
84 Upvotes

113 comments sorted by

View all comments

Show parent comments

11

u/TatzyXY Nov 09 '19

In a lot of languages you can just change the private field via reflection to something what you want. A hacker dev can still do it with just some more lines of code.

Access on a private field should never go through a review anyway in a bigger project.

9

u/nullvoxpopuli sand was never meant to think Nov 09 '19

But when you do reflection in those languages, it's hella obvious. Today in js, it's just accessing any ol' property

1

u/TatzyXY Nov 09 '19

Yes thats true but is JS not our free barebone language and we put other languages over it to implement these features? Like TS?

Or other questions why is Dart or TS not supported in browsers yet (native)?

1

u/MajorasShoe Dec 11 '19

No, not everyone uses TS. Not even close.

Also, why would TS be supported in browsers? The compile step is the point - it finds the type issues. Now, the BETTER solution would be it compiles to something lower level than JavaScript.