Forward proxies with private names

Herby Vojčík herby at mailbox.sk
Sun Dec 18 05:43:02 PST 2011


Hello,

I've come with the idea how to let proxies forward private names without 
compromising the private name and the value stored under it, as well.
Please, could revise it and find the flaws?

Thank you, Herby

The proposal:

1. for the [[Get]] handler (scenario when that is called with private name's 
.public is important, though this can used generally):
  If a get handler decides it will not produce a value, but wants to 
transparently pass the name to `target`, it should either `throw new 
ProxyDefaultGet;` or call `Proxy.defaultGet();`. This would immediately end 
the get handler itself and the machinery behind proxy call would simply 
issue target[privateName]. The handler will not see the name nor the value 
returned.

2. for the [[Set]] handler ...:
  Analogically with `throw new ProxyDefaultSet` or a call to 
`Proxy.defaultSet()`. Here it is q question if I can parameterize them with 
the value to be stored (thus leaving the proxy the ability to change stored 
value), or only let the original value stored under the private name.

(if needed for other handlers, analogical principle can be applied).



More information about the es-discuss mailing list