Save Object.observe()! (please) + make WeakMap/WeakSet observable.

William Edney bedney at
Tue Nov 3 23:14:11 UTC 2015

For those interested in using Proxies in the future, here are the
appropriate links to the two remaining holdouts (FF and MS Edge are already



Bug the appropriate owners ;-).


- Bill

On Tue, Nov 3, 2015 at 4:40 PM, Brendan Eich <brendan.eich at> wrote:

> Ah yes, the Smalltalk "become:" message, something that inspired
> SpiderMonkey's "Brain Transplants" -- see the [1] footnote at
>, and of course the
> bugzilla link, which leads to this:
> <> Brendan Eich
> [:brendan] 2010-07-19 17:53:44 PDT
> Burns:    [saws off the top of Homer's head.  No blood, very clean.
>            The top of Homer's head rolls away.]
>           Smithers, hand me that ice-cream scoop.
> Smithers: Ice-cream scoop?!
> Burns:    Dammit, Smithers, this isn't rocket science, it's brain surgery!
> ("If I Only Had a Brain", from "Treehouse of Horror II")
> /be
> On Tue, Nov 3, 2015 at 6:42 AM Matthew Robb <matthewwrobb at>
> wrote:
>> I probably have a terrible understanding of how this all works at a low
>> level but I feel like a potential solution would be a method of "upgrading"
>> a non-proxy object to be a proxy. The reason accessors are being used as
>> they are now is because you can retro fit them. Maybe what I am suggesting
>> is essentially like swapping out the internal pointer of an object with
>> another object (such as the way live module bindings work). In this way you
>> might upgrade an existing object to behave like a proxy.
>> - Matthew Robb
>> On Tue, Nov 3, 2015 at 3:20 AM, Tom Van Cutsem < at>
>> wrote:
>>> 2015-11-02 23:34 GMT+01:00 Coroutines <coroutines at>:
>>>> I come from Lua.  In Lua we make proxy objects with metamethods.  You
>>>> create an empty table/object and define a metatable with a __index and
>>>> __newindex to catch accesses and changes when a key/property doesn't
>>>> exist.  I would primarily use this in sandboxes where I wanted to
>>>> track the exact series of operations a user was performing to modify
>>>> their environment (the one I'd stuck them in).
>>> For this type of use case, you can use an ES6 Proxy <
>>> You can think of the proxy handler's methods as the 'metamethods' of the
>>> proxy object.
>>> What O.o would provide beyond Proxy is the ability to observe changes to
>>> already pre-existing objects. However, since you mention you'd start with
>>> an empty table/object, you should be able to create a fresh Proxy and use
>>> that to trace all property accesses.
>>> Proxies are particularly well-suited when you want to sandbox things,
>>> since you should be in control of the sandboxed environment anyway and can
>>> set-up proxies to intermediate. O.o is particularly well-suited to
>>> scenarios where there are already plenty of pre-existing objects and you
>>> don't know ahead of time which ones to observe and which not.
>>> Cheers,
>>> Tom
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list