using Private name objects for declarative property definition.

Allen Wirfs-Brock allen at wirfs-brock.com
Mon Jul 11 19:45:39 PDT 2011


On Jul 11, 2011, at 7:31 PM, Allen Wirfs-Brock wrote:

>>>> 
>>> 
>>> Agreed, these are both cases where the category isn't user extensible.  However, I think my statement holds for class-like categorization that are extensible.
>> 
>> Do we have any examples of those in the spec., or contemplated for ES.next?
> 
> See http://wiki.ecmascript.org/doku.php?id=strawman:es5_internal_nominal_typing #8: 
>  In JSON.stringify, use a isJSONArray property to control output in array literal syntax and eliminate corresponding [[Class]] check

also see 
https://docs.google.com/document/d/1sSUtri6joyOOh23nVDfMbs1wDS7iDMDUFVVeHeRdSIw/edit?hl=en&authkey=CI-FopgC&pli=1 :

The built-in method Array.prototype.concat (15.4.4.4) tests each of its arguments for [[Class]] equal to “Array” to determine whether the argument should be concatenated as a single object or whether it should be considered a transparent container of objects that are individually concatenated.   Because it is a class test it is context independent.

This test is problematic in that prevents used defined array-like objects from have this same transparent container behavior.  This applied even to objects that have the Array prototype on their prototype chain.   This transparent container treatment has no fundamental dependency upon the actual unique semantics of built-in arrays. It should be replaced with a check for some user-definable flag property that enables/disables transparent container treatment.


Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110711/4e52f5e9/attachment.html>


More information about the es-discuss mailing list