Invoke trap

Tom Van Cutsem tomvc.be at gmail.com
Mon Jun 10 00:51:49 PDT 2013


2013/6/9 David Bruant <bruant.d at gmail.com>

> Le 09/06/2013 11:37, Tom Van Cutsem a écrit :
>
>> The question is whether there's a strong need for intercepting these
>> operations. It implies a pretty strong growth of the handler API. And it's
>> not sufficiently general-purpose to also work for exotics that are defined
>> outside of ES6 (e.g. DOM objects).
>>
> I can live with DOM objects not being fully transparent (since they were
> designed a while ago without proxies in mind). If it were too complicated
> because they're legacy, Date and RegExp could be given up on too (I think
> they're doable though), but I feel all other ES6 objects should be fully
> transparent. They have no good reason not too.
>

To me they are all the same, and a good solution should be applicable to
any exotic object, whether defined in ES6 or not.
What would be gained by making e.g. ES6 Maps transparent, but not DOM
NodeLists?

Frankly I don't think a good generic solution exists. There is an inherent
trade-off between transparency (which requires "leaking" the |this|-value)
and encapsulation (which wants to protect the |this|-value).

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


More information about the es-discuss mailing list