On Wed, Aug 26, 2015 at 2:55 PM, Waldemar Horwat <walde...@google.com>
wrote:

> On 08/26/2015 09:09, Mark S. Miller wrote:
>
>> I don't get it. The conflict between
>>
>> * the history of ** in other languages,
>> * the general pattern that unary binds tighter than binary
>>
>> seems unresolvable. By the first bullet, -2 ** 2 would be -4. By the
>> second, it would be 4. Either answer will surprise too many programmers. By
>> contrast, no one is confused by either -Math.pow(2, 2) or Math.pow(-2, 2).
>>
>
> The grammar concerns have been resolved nicely upthread, so I'm not sure
> what your objection is.  The costs are no more significant than in the
> original proposal.  ** now has the same precedence as unary operators and
> weaker than the increment operators, which matches what most other
> languages that support exponentiation do.
>
> There is precedence for unary operators not always binding tighter than
> binary.  yield 3+4 is yield(3+4), not (yield 3)+4.


The force of that precedent is indeed what my objection is. The "yield"
counter-example is interesting, but "yield" is an identifier not an
operator symbol, and so does not as clearly fall within or shape operator
expectations.

If someone explains a compelling need for ** I would find that interesting.
But until then...



-- 
    Cheers,
    --MarkM
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to