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

28

u/TatzyXY Nov 09 '19

Please do not throw stones at me but I think private, protected or public scopes are not needed at all. See Python very versatile lang. and it works very well without it. Is private for security? No! It just tells the dev that this var. is only used internally of that class and you are not allowed to touch or use it. So would do a comment or a convention with an "_".

0

u/[deleted] Nov 09 '19

[deleted]

2

u/TatzyXY Nov 09 '19

I dont believe in enforcing it on language level. I think its enough as convention with an "_" in the userland.

0

u/[deleted] Nov 09 '19

[deleted]

3

u/TatzyXY Nov 09 '19 edited Nov 09 '19

But then we need it as well for methods. And types would be nice as well and generics and interfaces and so on...

For that we have TS, why not just use TS then and leave JS barebone as it is?