Anne van Kesteren
annevk at annevk.nl
Tue Dec 18 13:36:59 PST 2012
On Tue, Dec 18, 2012 at 6:01 PM, Allen Wirfs-Brock
<allen at wirfs-brock.com> wrote:
>> It seems you either need to use a Proxy, some kind of wrapper method,
>> or a custom implementation in most cases. Typically when objects akin
>> to Map or Array are exposed in a platform API, mutating them has
>> observable (synchronous) side effects.
> proposes a mechanism that would support defining such object behaviors
> without requiring the full magic of Proxy.
I think we're talking past each other or I might be misunderstanding.
Lets say that hypothetically Map is sufficient for URL query
parameters and we do not need a MultiMap for its semantics. We have a
URL object and you can get to its query parameters using
URL.prototype.query. That property cannot point directly to a Map
because when I perform an operation on that Map, say
query.delete("x"), not only should "x" be deleted from the Map, it
should also be removed from URL's string synchronously. The latter
does not seem possible using Map directly, but such a pattern is found
(That delete()'s and friends argument needs to be stringified is
another reason of course that makes it hard to reuse native types
More information about the es-discuss