Syntax Proposal: Allow Java-like Object Literals after constructor calls to set properties on created objects.
Allen.Wirfs-Brock at microsoft.com
Wed Jun 30 18:16:07 PDT 2010
I actually think that our biggest mistake in designing ES5 was making the attribute defaults used by defineProperty different from the defaults use by other property creation methods. I think the new attribute names are fine but the argument that they needed to default to false is weaker than the desirability for consistancy across all property creation techniques. But what's done is done and past mistakes serve as good lessons for the future.
> -----Original Message-----
> From: es-discuss-bounces at mozilla.org [mailto:es-discuss-
> bounces at mozilla.org] On Behalf Of Brendan Eich
> Sent: Wednesday, June 30, 2010 4:31 PM
> To: Jürg Lehni
> Cc: es-discuss; Erik Arvidsson
> Subject: Re: Syntax Proposal: Allow Java-like Object Literals after constructor
> calls to set properties on created objects.
> On Jun 30, 2010, at 4:24 PM, Jürg Lehni wrote:
> > On 30 Jun 2010, at 23:32, Brendan Eich wrote:
> >> On Jun 30, 2010, at 2:15 PM, Erik Arvidsson wrote:
> >>> Sorry, Object.create was a mistake.
> >> A bit harsh, but my point is not about tone -- it is that the mistake in your
> view is the default values for missing attributes being false, not true. Right?
> > Rather than having missing boolean values default to true which somehow
> contradicts ES behavior when dealing with undefined boolean values (!undefined
> == true), I would have preferred if the properties were defined as their
> opposites, so default to false would make more sense: writable -> readOnly,
> configurable -> sealed, etc. But I guess it is what it is now.
> This was all discussed in the ES3.1 -> ES5 days, indeed. The ES1-3 "DontDelete",
> "DontEnum", and "ReadOnly" names are awkward for being negative ("Dont", "-
> Only"), resulting in double negative phrasing when documenting and discussing.
> And you're right that attribute-property-missing -> undefined -> false has an
> effect here. If we had kept the ES3 negative names, we could have defaulted to
> false and Erik (I think) would not find Object.create a mistake -- but then the
> high-integrity-by-default fans would be put out. Those fans should speak up if
> they care to defend against the "mistake" charge.
> Anyway, ES5 is done. Life goes on, though, with Harmony. There's not much that
> can be done about the default attribute values and the sense of their names,
> Same for Object.keys vs. Object.getOwnPropertyNames method-naming-style
> disparity. Food for thought, in order to do better in the future.
> es-discuss mailing list
> es-discuss at mozilla.org
More information about the es-discuss