Live data from Hacker News

JavaScript TC39 implementing hashmark private class fields

github.com

1–10 of 81 posts

Re: JavaScript TC39 implementing hashmark private class fields

#5

Kinda disappointing. I don't really like the # for privates. It's not an elegant solution. It feels a bit like a one-off hack honestly.

Right now I'm prefixing variables I don't want external actors to change with underscores, which doesn't actually do anything, so is arguably more of a hack. :P

Re: JavaScript TC39 implementing hashmark private class fields

#9
post #7

Seems like a pretty fair and well though out solution after reading the latest response by bakkot.

Agreed. I've been following the spec for a few months and while # is "ugly," it serves the purpose of the concept well and works with the current spec/implementations without much headache. Seems like a win-win to me and I haven't seen a convincing argument for why private # properties shouldn't move forward as they are.

Re: JavaScript TC39 implementing hashmark private class fields

#10
post #3

Can someone provide some context? This link just drops you into the middle of the argument.

Some in the JavaScript community have been asking for private members as a language feature and some folks do not want this as there is a subset of JavaScript programmers who worry about many concepts from OOP "polluting" the relative minimalism of JavaScript. A fear I share to a certain extent.

From reading the thread it sounds like some feel that the addition of private members is being accomplished by fiat rather than community consensus.

Post reply on HN