suggestion: mapping symbolic infix ops to binary functions

Brendan Eich brendan at mozilla.com
Tue Jul 24 07:29:20 PDT 2012


Claus Reinke wrote:
> One solution would be to inline the operator definitions at the call 
> sites. But that would turn a simple desugaring into a non-trivial 
> transformation. And we'd be partway towards macros..

No such state (partway pregnant).

> The other solution would be a way to pass References around,
> but the last time I raised the issue of reifying References I was told 
> that some engines could not easily support that, iirc.

No engine reifies References exactly as in the spec, to my knowledge. 
Too expensive.

Rather, d.items(i) = ... must parse but throw in non-legacy-IE 
implementations. SpiderMonkey used to support built-in methods returning 
(obj, id) pairs, which combined with the lvalue special forms worked at 
runtime with a dynamic check (for built-ins that returned only single 
value instead of a pair).

Anyway, as you say this is a dead end. Allen is working to remove the 
lvalue special forms and freedom for host objects to return References 
from the spec.

> Are macros really the only way to get around JS's peculiarities
> when trying for user-defined operators and control structures?
> And how far away are they? 

Hard to say. Let's get modules done first.

/be


More information about the es-discuss mailing list