Notification proxies (Was: possible excessive proxy invariants for Object.keys/etc??)

Allen Wirfs-Brock allen at wirfs-brock.com
Sun Nov 25 12:40:49 PST 2012


On Nov 25, 2012, at 4:15 AM, Brandon Benvie wrote:

> I think it could be argued that the two categories of proxy uses have different enough fundamentals that they would be better suited broken into two separate types of proxies. They use a common protocol for dispatching notifications/requests, but the result is incompatible.
> 
> For a Notification Proxy the trap is notified and then action proceeds against the ProxyTarget as it would normally. This is the simple case since it merely adds a pre-notification to the front of all trapped operations and nothing else changes.
> 
> For a Virtual Proxy the invariant-sensitive attributes of the virtual target act like those of a Notification Proxy. Any time something becomes invariant, whether it be a property or the whole object, the value is reified from being virtual to being an actual property. From that point on the property or the whole Proxy changes behavior from Virtual to Notification. 

And using the new specification MOP this would be quite easy to specify. I even suspect that it would be fairly easy to implement, assuming that engines actually dynamically dispatch internal method calls at approximately the granularity of those specified by the MOP.

I actually had the thought as I was working through the MOP and the Proxy internal methods, that I'd wager that somebody is going to come up with other proxy like abstractions that are optimized for different scenarios and that they'd eventually get implemented.

Allen













> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list