Catch-all proposal based on proxies
mjs at apple.com
Thu Dec 10 18:42:16 PST 2009
On Dec 10, 2009, at 5:09 PM, Mike Samuel wrote:
> 2009/12/10 Mark S. Miller <erights at google.com>:
>>> hasOwnProperty - cannot for non host objects
>>> Incidentally, is Object.prototype.hasOwnProperty(myProxy)
>>> O(myProxyHandler.keys().length) for proxies? This seems bad since a
>>> for (in) loop that filters out non-own properties would be O(n**2)
>>> top of the loop body.
>> By the current taxonomy, Object.prototype.hasOwnProperty(myProxy) is
>> meta-level and always returns false on a trapping proxy, revealing
>> that it
>> does not actually have any own properties.
> Hmm. So a proxy of an object cannot be used as a drop-in replacement
> for that object with any code that uses own property loops like
> for (var k in o) if (Object.hasOwnProperty.call(o, k)) ...
> That seems to make it less useful.
It would also make this mechanism unsuitable for building emulations
of DOM objects that have catchall properties in pure ECMAScript. Is
that a design goal for this mechanism?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss