Allen Wirfs-Brock wrote:

Below...
Brendan Eich <bren...@mozilla.org> wrote:
 > Allen Wirfs-Brock <mailto:al...@wirfs-brock.com>
 > January 23, 2012 8:43 AM
 > On Jan 22, 2012, at 7:36 PM, Tab Atkins Jr. wrote:
 >
?..
 >
 > const getIterator = Iterator.getIterator;
 > myCoolObject.prototype.@getIterator = function() {...}

Why wouldn't myCoolObject.prototype[iterator.getIterator] work?

/be

It would, for now. But, I think you gave the reason for avoiding this
pattern in another reply. If we ever want to adopt my Reformed Object
Model proposal then we should avoid using [ ] for private name property
access. lt would actually still work fine for objects with default [ ]
behavior but not for collection objects that redefine [ ] access.

Losing generic [] as a way to access all "native" properties of the object is big price. What about half-way: modify object reformation to have "native []" and "logical []" in parallel.

You can use
  x.foo
  x["foo"]
  x.["foo"]
syntaxes (and x.@priv, too), and if you define the latter as "native property access", for the time being equivalent to [], but later [] can be redefined (or vice versa, but it seems .[] is more akin to . and .@ and [] seems better for "logical" element access), you've got the collection [] but don't lose the object-structural [].

Allen

Herby
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to