Closed
Bug 586095
Opened 15 years ago
Closed 14 years ago
eliminate __call__ and __construct__
Categories
(Other Applications Graveyard :: Narcissus, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: dherman, Unassigned)
References
Details
The __call__ and __construct__ special properties leak an implementation detail of Narcissus into user code. Worse, they require hacking Function.prototype. It should be possible to use the call/construct behavior of function proxies to eliminate the reliance on these special properties entirely.
Dave
Reporter | ||
Comment 1•15 years ago
|
||
Okay, so here's the difficulty with this bug: Narcissus needs special "back-door access" to the underlying FunctionObject, and anything we expose through the proxy will be exposed to user code.
A hack would be to create a "capability" object that you can pass to the proxy function that would convince it to hand you back the FunctionObject, and the capability would not be shared outside the interpreter. But this would be expensive and pretty baroque.
A more straightforward approach would be to use private names (http://wiki.ecmascript.org/doku.php?id=strawman:names) instead of __call__ and __construct__. If those get into SpiderMonkey we should probably do it that way.
Dave
Reporter | ||
Comment 2•14 years ago
|
||
The best way to do this is with WeakMap. It's in both V8 and SpiderMonkey, so we should just go ahead and do it. Totally efficient portability for jsexec isn't important.
Dave
Comment 3•14 years ago
|
||
It's in v8 for now only behind a flag that is not turned on by default. I don't know if this is relevant to your plans.
Reporter | ||
Comment 4•14 years ago
|
||
> It's in v8 for now only behind a flag that is not turned on by default. I
> don't know if this is relevant to your plans.
Thanks. I'm not super worried about it. The interpreter module is the part of Narcissus that isn't really used by anyone, it's more of a technology demonstrator. So I'm going to keep pushing ahead to show how proxies and weak maps work nicely for a self-hosting interpreter.
Dave
Reporter | ||
Comment 5•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Updated•7 years ago
|
Product: Other Applications → Other Applications Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•