`new Object` vs `Object` difference

Bucaran jbucaran at me.com
Fri Jun 12 23:29:43 UTC 2015


JS is very much like writing with a pen (traditionally speaking). We can only try to make less errors 
as we move forward, but what’s there it’s there and it’s either too expensive or impossible to change.



> On Jun 13, 2015, at 7:33 AM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
> 
> 
> 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 <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
> 
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

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


More information about the es-discuss mailing list