Loyal Opposition to Const, Private, Freeze, Non-Configurable, Non-Writable...

David Bruant bruant.d at gmail.com
Wed Nov 2 09:44:22 PDT 2011

Le 02/11/2011 17:26, John J Barton a écrit :
> On Wed, Nov 2, 2011 at 9:05 AM, Jeremy Ashkenas <jashkenas at gmail.com> wrote:
>> On Wed, Nov 2, 2011 at 11:01 AM, David Bruant <bruant.d at gmail.com> wrote:
>>> Could you elaborate on this point?
>>> All object-lockdown I can think (non-configurability, non-writability,
>>> non-enumerability, private names, const variables, const classes) of is
>>> optional. Why are you against them?
> ...
>> The freedom of having every object and every property be configurable,
>> settable, introspectable, readable and writable, at least at the language
>> level, is worth the trade off. If we add const, private, and other lock-down
>> syntax, or make class properties private by default (shudder), I guarantee
>> you that many potential innovative libraries that otherwise might spring up
>> will never even be conceived, and frustrating situations that could have
>> otherwise been solved by a quick patch will instead require convoluted
>> work-arounds.
> Another maybe stronger argument is simplicity: these myriad new minor
> features create a blizzard of chaff in the way of developers. One
> excellent example is Object.create(). Here was a terrific opportunity
> to simplify the language based on years of experience and analysis.
> But instead of an object as a second argument, we got a descriptor
> requiring many details for each property. Of course these details are
> important for the use-cases that need them. Unfortunately everyone
> else has to carry the baggage.
I agree that the second argument is a design mistake. But ES6 will fix
this with the proto operator.

More information about the es-discuss mailing list