There's a reason Object.observe is async: it prevents you from changing how the value is first assigned, so it can't work like a proxy. And question: how does it let you see hidden closures?
On Tue, Nov 3, 2015, 18:28 Coroutines <[email protected]> wrote: > On Tue, Nov 3, 2015 at 3:22 PM, Coroutines <[email protected]> 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 > > debugging. > > 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? > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

