Re: Figuring out easier readonly interfaces

On Wed, Oct 2, 2013 at 2:17 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 10/2/13 5:10 PM, Tab Atkins Jr. wrote:
>> From what I can tell, the easiest way to do this is to use a Proxy
>> around the mutable instance, which intercepts the "set" and
>> "deleteProperty" traps (and maybe "defineProperty"?) and cancels them,
>> and forwards the rest of the traps.
>
> So directly .apply()-ing a setter gotten off the prototype would still
> mutate the object?

I don't think so, but I could be wrong.  I think that still ends up
trying to do a "set" on the proxy, which'll get intercepted and
cancelled.  It just takes a more circuitous route to get there.

(I can't find the Proxy definitions in the latest HTML version of the
ES spec, so I'm going on the most recent wiki page defining this stuff
for now.  Publishing specs as Word documents continues to be
ridiculous.)

~TJ

Received on Wednesday, 2 October 2013 21:25:56 UTC