3 ms·
In general, the people writing language features out of fear cause the bulk of the problems. Js had coped quite well without having private fields. We had conv
by rektide 4y ago
In general, the people writing language features out of fear cause the bulk of the problems.
Js had coped quite well without having private fields. We had conventions of using this._field that served fine, that cautioned users sometbing was internal-ish without binding them, without preventing experimentation.
The private function implementation is more bad language design seeming on an inevitable course to make the language worse & less capable. It's more fear, more adding nothing, more creating friction, like private fields.
That all said, it doesn't seem like proxies ought be broken by private class fields. That's another heap of scorn placed upon this already tragic & harmful misfeature.
- claytongulick 4y agoI was amongst many who argued vocally against this proposal back when it was in stage 1. There was a huge community backlash against it, which tc39 blithely ignored. It made me lose confidence in tc39 completely. Whatever their motivations are, they are clearly not influenced by community feedback, at least not for this feature.
- ricardobeat 4y agoSame. At this point I've just given up hope on JS remaining a simple language, it’s already beyond repair.
- jwalton 4y agoI also argued strongly against this proposal. To me the biggest problem with private members, as it was implemented, is that is takes classes from “syntactic sugar on top of prototype inheritance” to something very different than that. It makes the mental mode of the language a lot more complicated, and without a lot of benefit. I never understood why TC39 was so intent on this “hard privacy” stance they took, as without it there were much better and more sensible compromises that could have been made. (Especially since JS is an interpreted language - if someone wants to work out what private variables are in your code, they can always just inspect the source.)
- hajile 4y agoEven worse, it came at the expense of other things. Records and tuples for example aren’t controversial. They are primitives and therefore solve a few quirks that come from objects. They should also radically improve performance because users can’t change types or add/remove properties causing less optimized lookups. Instead, all that time went into a controversial feature that has made things worse without solving any real issues either.