Le 15 mai 2014 à 20:17, Rick Waldron <[email protected]> a écrit :

> 
> 
> If the "." was on the other side?
> 
>   AccessorAssignmentOperator :
>     .= IdentifierName
> 
> 
>   var string = "  a  ";
>   string .= trim(); // would throw if no `trim` method existed for `string`
> 
>   string; // "a";
> 
>  
> Where ".=" means assign the result of "Property Accessors Runtime Semantics 
> Evaluation" with lval and rval in appropriate positions (TBH, I'm sure I 
> missed something in there)

There is an interesting question of precedence/associativity. Normally, for a 
binary operator @, the two lines are more or less the equivalent:

        a @= foo(bar).baz() + quax
        a = a @ (foo(bar).baz() + quax)

But when you write, say

        str .= replace(/_/g, ' ').trim() + '  foo'

you probably don't mean

        str = str.(replace(/_/g, ' ').trim() + ' foo')

but rather:

        str = (str.replace)(/_/g, ' ').trim() + ' foo'

        
—Claude

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to