Exponentiation operator precedence
Mark S. Miller
erights at google.com
Thu Aug 27 03:21:40 UTC 2015
On Wed, Aug 26, 2015 at 6:19 PM, Waldemar Horwat <waldemar at google.com>
> On 08/26/2015 15:08, Mark S. Miller wrote:
>> 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
>> If someone explains a compelling need for ** I would find that
>> interesting. But until then...
> ** is a convenience, and that's the wrong criterion to apply here. If it
> were, then we wouldn't have useful conveniences like Math.cosh or arrow
> I'd rather read
> a*x**3 + b*x**2 + c*x + d
> a*Math.pow(x, 3) + b*Math.pow(x, 2) + c*x + d
Ok, we have a benefit to evaluate. Brevity. With the example contrast
a*x**3 + b*x**2 + c*x + d
a*Math.pow(x, 3) + b*Math.pow(x, 2) + c*x + d
Let's also apply Alexander's suggestion
a*x.pow(3) + b*x.pow(2) + c*x + d
To help us compare for brevity, and because I'm too lazy to count, I'm
sending it in a fixed width font.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss