Tech talk on proxies and traits
brendan at mozilla.com
Sat May 1 15:33:01 PDT 2010
On May 1, 2010, at 2:49 PM, Dmitry A. Soshnikov wrote:
> Hello Mark,
> Sunday, May 2, 2010, 1:02:36 AM, you wrote:
>> On Sat, May 1, 2010 at 1:27 PM, Brendan Eich <brendan at mozilla.com>
>>> On May 1, 2010, at 12:34 PM, Faisal Vali wrote:
>>>> As I read the proposal, I do wish an invoke-like trap had been
>>>> accepted - but I understand that there were some technicalities
>>>> proved unresolvable.
>>> Everyone wants __noSuchMethod__
>> I don't. I want proxies instead. ;)
I meant "Everyone" to mean "many people" -- for the convenience.
> By the way, why exactly proxies? And not special meta hooks such as
> __noSuchMethod__, __construct__, __call__, __get__, __set__ and other?
Mark and Tom's write-up is on the wiki, have you read it?
Stratifying means native objects need no magic meta methods which can
be hijacked by user code. This is important for the spec's soundness,
as well as for security and ease of implementation/optimization.
Nothing reserved __names__, that is just a Python convention, and C,
or really the C pre-processor I suppose. The ship has sailed. Even if
we could reserve __names__, mixing traps and base methods is a recipe
for spec unsoundness, insecurity, and implementation bugs and slowness.
Proxies avoid all these problems. They are truly winning, we have an
implementation nearly done for SpiderMonkey so I can write this as an
The only issue that nags at us is the loss of a convenient invoke trap
that preserves evaluation order. One could be added, but it is
tantamount to creating (or hitting a cached) Proxy, in order to
preserve order of evaluation.
More information about the es-discuss