super, methods, constructors & Co.

Oliver Hunt oliver at apple.com
Fri Jun 1 10:10:19 PDT 2012


On Jun 1, 2012, at 8:30 AM, Domenic Denicola wrote:

>> -----Original Message-----
>> From: es-discuss-bounces at mozilla.org [mailto:es-discuss-
>> bounces at mozilla.org] On Behalf Of Allen Wirfs-Brock
>> Sent: Friday, June 01, 2012 04:05
> 
> 
>> We haven't eliminated the ability to define object literals that inherit
>> from objects other than Object.prototype.  We have just changed the
>> syntax for specifying them from:
>>  proto <| {}
>> to
>>  {__proto__: proto}
> 
> For anyone who (like me) was confused by this in light of all the talk that colons in object literals always do a [[DefineOwnProperty]], there is an exemption made for __proto__ in section B.3.1.3 of the latest spec.

That exception is required as the spec placed __proto__ on the Object prototype, and existing content requires {__proto__: ...} to set the prototype.  JSC didn't have this problem in the past as __proto__ was a magical property that all objects had and shared with all the world.  This made Mark sad :-(

For the record, I agree with Luke that super, etc shouldn't be allowed outside of actual class definitions.  The semantics become confusing, and the implementation complexity of super goes up even for super used in a class.

Also, I won't be around on email for the next week or so as I'm helping out on the ALC (if you feel like sponsoring here's a url: http://www.tofighthiv.org/site/TR/AIDSLIFECYCLE11/AIDSLifeCycleCenter?px=2583919&pg=personal&fr_id=1440)

--Oliver

> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list