[Harmony Proxies] Proposal: Property fixing

David Bruant david.bruant at labri.fr
Sat Jun 18 15:01:48 PDT 2011

Le 18/06/2011 05:35, Mark S. Miller a écrit :
> An even better example where Tom and I used these invariants, even if
> only for an illustrative example, is
> <http://wiki.ecmascript.org/doku.php?id=harmony:proxies#an_eventual_reference_proxy>.
> The old text at the bottom of this old code says: 
>     "Note: |localFarReferenceMaker| should work even if |obj| is a
> host object."
A couple of things on this code:
* var pds = Object.getProperties(obj);
=> strawman:extended_object_api suggests the name

* var nonConfigurableOwnProperties =
      Object.freeze(nonConfigurableProperties.filter(function(name) {
return !!({}).getOwnPropertyDescriptor.call(obj, name); });
=> I think the filter should be ({}).hasOwnProperty.call(obj, name); (no
need for !! since hasOwnProperty already returns a boolean)

* isEnumerableOwn
=> This is not a trap (anymore?)

* In "enumerate" and "keys" traps, you do not take "enumerable" into
account, is it on purpose?

* This abstraction does not take into account whether an property of obj
has later been set to "configurable:false". (But I don't know purpose of
an eventual reference, so it might be on purpose)

* There are no defineProperty, getPropertyNames or
getOwnPropertyDescriptor traps (which are fundamental traps). Is it on

> Were these invariants relaxed, abstractions such as this would either
> be incorrect or be much less precise and therefore less useful.
What is the purpose of this abstration? How is it used?

On a slightly unrelated note, you use setTimeout(f,0) several times. I'd
like to point out that Malte Ulb very recently showed
(http://jsperf.com/postmessage) that setTimeout(f,0) is not very good
performance-wise and that posting a message to oneself
(window.postmessage) is far more efficient.
This is neither part of ECMAScript, nor supported by all browsers
(should be by IE8, but the test doesn't work for a reason I have tried
to find and given up on), but in relevant contexts, i'll stop using

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110619/ffb20c45/attachment.html>

More information about the es-discuss mailing list