Save Object.observe()! (please) + make WeakMap/WeakSet observable.
coroutines at gmail.com
Tue Nov 3 23:28:24 UTC 2015
On Tue, Nov 3, 2015 at 3:22 PM, Coroutines <coroutines at gmail.com> wrote:
> But because of what Object.observe() can do to see into closures, I'd
> relegate it to privileged code :> It is incredibly useful for
I really need to make sure my thoughts are complete before I send a message.
Anyway, I just wanted to say I'm viewing this through my experience with Lua.
In Lua you would make a proxy (like I mentioned before) by creating an
empty table and setting the __index and __newindex metamethods to
trigger when a key doesn't exist for an access or having its value
set. This is the only way to watch for changes, you cannot attach a
watch to an existing object - you create a separate object to act as
the proxy and replace the references to the existing/target object.
My last message was me realizing that Object.observe() has
functionality that would let you see into encapsulated, hidden
closures. This is why I think Object.observe() is cool but probably
shouldn't be web-accessible.
Proxy is safe, Object.observe() should be debug-only functionality
((imo)). Like, in browsers you'd only have access to it from the
console not from within a page?
More information about the es-discuss