On __proto__ as a magical data property

Tom Van Cutsem tomvc.be at gmail.com
Wed Jul 18 10:54:52 PDT 2012


2012/7/18 Andreas Rossberg <rossberg at google.com>

> On 18 July 2012 12:35, David Bruant <bruant.d at gmail.com> wrote:
>>
>> Proxies are an even more fundamental violation of the JS object model.
>>
>
> Agreed (and one of the reservations I actually have about adding proxies).
> However, proxies are proxies.
>

I disagree ;-)

I think as a byproduct of designing the Proxy API we now actually have a
pretty well-defined *interface* to a JS object.
The invariants called out in the "invariant enforcement" section on the
wiki can be thought of as the minimal contract that comes with the
interface. Proxies in some sense define the JS object model. Any
implementation that satisfies the minimal contract does not violate the
object model. Whether an implementation is a sensible implementation of the
interface is a whole other matter.

True, we cannot efficiently _enforce_ many behavioural invariants for
> (user-defined) proxies. But that does not imply that we should feel free to
> actively _break_ more invariants for (language-defined) non-proxies.
>

I absolutely agree here.

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120718/5f339af5/attachment.html>


More information about the es-discuss mailing list