Pow operator precedence
Mail Mantis
mail.mantis.88 at gmail.com
Fri Jan 13 08:58:11 PST 2012
2012/1/13 Don Clugston <dac at nospam.com>:
> On 13/01/12 14:47, Manu wrote:
>> I would certainly have made this mistake if I tried it. And knowing this
>> information will not cause me to do it properly, it will simply make me
>> question my code, and become very suspicious every time I ever use the
>> operator (ie. I will never understand the proper precedence, I don't
>> think it makes sense).
>> I'm fairly amazed it's not the other way around... what's the logic
>> behind this?
>
>
> Originally it worked the other way, but bearophile complained about it, so
> it got changed to this way <g>.
>
I agree to this - meanwhile I've chosen to use std.math.pow to avoid confusion.
Anyway, current convention violates the consistence of the language's
rules, while other one would be confusing to people who have
python/put_language_name experience. In either case, this operator
will be ambiguous for someone. Since C doesn't have such operator, I
don't see a proper way to solve it. Maybe it would be good to always
require explicit parenthesis in such expressions?
More information about the Digitalmars-d
mailing list