Hi Claus,

I'm not sure I fully understand your proposal, but could you not achieve it
by simply doing:

var target = ...; // might be frozen
var p = Proxy( Object.create(target), handler);

?

Cheers,
Tom

2013/1/17 Claus Reinke <claus.rei...@talk21.com>

> The proxy target is important because it specifies some invariants about
>> the proxy (typeof, builtin brand, behavior of forwarding for unspecified
>> traps, values of internal properties like [[DateValue]], [[NumberValue]],
>> etc.).
>>
>
> That is probably the most important difference between direct
> proxies and old-style proxies. Yet I find it slightly limiting and
> accident-prone: it uses invariants and target to make proxies
> not just behave like an object, but to behave like the target.
>
> Presentations on direct proxies tend to present too usage patterns:
> wrapped objects and virtual objects.
>
> My problem is: if I am using proxies as wrappers, I want to use
> the target object as a -wait for it- prototype, to be *modified* by
> the proxy. But if the target object happens to be frozen, modified returns
> are no longer allowed by the invariants. To cover this
> eventuality, I should use the virtual object pattern even if I
> just want to wrap an object!
>
> Would it be possible/helpful to use the target merely as a __proto__
> instead of a harness, inheriting the target's internal properties without
> over-constraining the proxy's ability to
> modify the wrapped target's behavior? Invariants could still use an
> implied object for freezing the *proxy*, so the proxy would behave as an
> object, not necessarily the same as the target object.
>
> Claus
>
> ______________________________**_________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to