`new Object` vs `Object` difference

Allen Wirfs-Brock allen at wirfs-brock.com
Fri Jun 12 22:33:38 UTC 2015


On Jun 12, 2015, at 2:47 PM, Benjamin Gruenaum wrote:

> That's good to know and it's good to know I'm not the first one to spot this.
> 
> While we're visiting the spec on that:
> 
> Why is it specified that "When called as a constructor it creates a new ordinary object. When Object is called as a function rather than as a constructor, it performs a type conversion." - wouldn't it make more sense to remove that or specify "behaves the same way"?

yes, probably

> 
> Where is it actually explained what Object does when called as a constructor?

It doesn't because the behavior is seem in both cases.

Step 1 of http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-value is looking for the case of a `super()` call from a subclass constructor.

> 
> The difference - at least in the phrasing of Object vs Array seems to be just as present in the latest spec draft from what I can tell.

Yes, the Object description still contains some ancient language that  should probably be removed in the future as it adds not (except perhaps confusion) to the spec. 

Allen


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150612/f248552b/attachment.html>


More information about the es-discuss mailing list