1. 14

  2. 1

    If the industry has realized encapsulation has caused more hard than good, why did private fields come to ECMAScript and why is the standards body putting so much effort into the erognomics (getters, setters, now private fields)?

    1. 2

      IMO it’s the rot from developers’ general rejection of prototypal inheritance and the implementation of ES6 features. Javascript’s bastion of hope to hold on to marketshare is to give you the experience of writing like you do in other languages. JS is generally feature complete for 90% of use cases since ES5.


        I would agree–then TCO is proposed and major browsers didn’t implement it. The only thing I’ve been rooting for in recent times is the Records+Tuples proposal as it’s immutable and has fast comparison.


        I can’t provide documentary evidence for this but I bet this is more of MarkM’s work to make JS more suitable for safe interactions between mutually suspicious objects. Being able to tightly control which clients can invoke a method is useful for capability-security style access control.