Forward proxies with private names

# Herby Vojčík (14 years ago)

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).

# David Bruant (14 years ago)

Le 18/12/2011 14:43, Herby Vojčík a écrit :

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.

It is an interesting idea, but is there a use case associated with this idea? As far as I'm concerned, I've been advocating to being able to give access to a proxy to a private name directly (without correspondance map).

I'm currently writing a proxy that records all activity happening on an object for the purpose of being able to "replay" the different states an object has gone through.

Unfortunately, your proposal does not cover this use case.

Please, could revise it and find the flaws?

The main thing that bothers me with your proposal is that you hand the responsibility to use the private name to the proxy (without giving it a direct access to the name which, I admit, is an interesting idea). I think the private name owners should be the ones deciding who they trust and how they collaborate/communicate with the private name.