[Harmony Proxies] Proposal: Property fixing

Brendan Eich brendan at mozilla.com
Wed Jun 15 09:00:45 PDT 2011


On Jun 15, 2011, at 8:51 AM, Allen Wirfs-Brock wrote:

> From a posting I made earlier in this thread:
> 
>> Doesn't this new proposal still preclude using proxies to create an exact emulation of the built-in Array object type.  The "length" property of arrays is specified to be non-configurable yet special behavior must occur each time the value of length is changed.  The proposal would allow "length" to be "fixed"  as an accessor property whose set behavior did the necessary processing.  However, that is also a violation of the Array specification as it requires that "length" exhibit the attributes of a data property. 
>> 
>> I emphasize Array when I look at this simply because it is a fairly simple example of the sort of thing that a host object might currently do and the most important use case of proxies for me is the replacement/emulation of host objects.  I really don't know where this idea that non-configurable implies no special semantics comes from.  That isn't the case in the ES5 specification  (10.6,15.3.5.4,15.4.5.1+15.4.5.2, 15.5.5.2) for such properties.  

D'oh, I see.


> More generally, for better or worse, Cameron McCormack is right now busily working to publish the last call draft of a Web IDL specification that includes rules for what the attribute settings must be for all DOM properties.  If those rules don't match up with what proxies can express then there will be issues with implementing the DOM in ECMAScript.

Paging Dr. Van Cutsem!

To emulate length as non-configurable but magically changing its value as a data property may be possible with proxies. It is after all writable.

/be


More information about the es-discuss mailing list