I feel like i'm spamming this link every time the private fields stuff comes up, but take a look at the FAQ, it explains the reasoning behind it and why they didn't go with alternate options (like underscore, private, or others).
I was against it at first, but after reading through that document, i'm on their side now. It'll be a small but useful addition in some situations, and it's scope is extremely limited.
Yeah I have to agree with this. I'm getting this vibe from a lot of changes to JS lately. A mess designed to cover another mess and people almost blindly supporting the new mess just because there is some logical rationale for it.
There have been intense debates already for this decision. The fundamental reason is because Javascript has a messy "this.fieldname" requirement to access public fields so the only way to use a private field requires a symbol to denote that its private and not overlapping.
I would've preferred the "this.private.fieldname" instead but # is what ended up winning.
I was against it at first, but after reading through that document, i'm on their side now. It'll be a small but useful addition in some situations, and it's scope is extremely limited.
https://github.com/tc39/proposal-class-fields/blob/master/PR...