Question about direct proxies syncing their targets

David Bruant bruant.d at gmail.com
Fri Jan 13 17:08:09 PST 2012


Le 14/01/2012 01:57, Tab Atkins Jr. a écrit :
> In the direct proxies proposal at
> <http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxies>,
> there's the following line:
>
> get:
>  * Invariant checks:
>     * if property exists on target as a data property, updates the
> target’s property with the returned value
There is also the following line in introduction:
"A proxy ensures that its handler and its target do not contradict each
other as far as non-configurability and non-extensibility are concerned."

> Consider an xrange object like from Python, which represents a numeric
> range (with a start, stop, and step) and exposes both an iterator and
> get traps.
>
> Am I correct in assuming that, since the target of an xrange proxy is
> an empty object, iterating through the xrange or getting specific
> values from it will *not* fill up the target in an attempt to
> synchronize it with the returned values from the get trap?
My understanding is that as long as the iteration and property gets
don't create or report non-writable and non-configurable properties,
nothing will be done to the target.

It seems that the case you describe would be a good candidate for
"virtual objects" [1]

David

[1] http://wiki.ecmascript.org/doku.php?id=harmony:virtual_object_api


More information about the es-discuss mailing list