using Private name objects for declarative property definition.
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
The built-in method Array.prototype.concat (184.108.40.206) 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss