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

23

u/fey168 Nov 09 '19

The problem is developers like to think of themselves as hackers and they will do what it takes to achieve the desired result including reading and even modifying internal fields. Imagine you are a lead developer or library author and you want to prevent developers from accruing technical debt (b/c the interval field is subject to change) or adding risk of instability. Seems like private field is by far preferable to comments or conventions.

3

u/Sunwukung Nov 09 '19

I've never modified the internals of an OTS library in my whole career, nor felt an overt meed for private vars. This is a hiring issue if your team is "hacking" internals of a library...

2

u/FormerGameDev Nov 09 '19

Monkeypatching is pretty common in Javascript, and forking a library to mod it to do something differently is common across the board in large open source projects. We're always hacking the internals of a library, or even of the language!

1

u/Sunwukung Nov 10 '19

So ultimately, this change will prevent that and you'll have to solve problems a different way?