Pow operator precedence

Manu turkeyman at gmail.com
Fri Jan 13 10:18:34 PST 2012


On 13 January 2012 19:41, Matej Nanut <matejnanut at gmail.com> wrote:

> I feel it should be left as is: it'll be ambiguous either way and why mess
> with how it's in mathematics? If anyone feels uncomfortable using it,
> just use std.math.pow. Many other languages don't have this operator so
> people coming from them won't know it exists anyway (like me until this
> post).


Expecting all people who may be uncomfortable with it to use pow() doesn't
help those who have to read others code containing the operator.
It's NOT like it is in mathematics, there is no 'operator' in mathematics
(maths uses a superscript, which APPEARS to be a unary operation). When
using the operator, with spaces on either side, it looks like (and is) a
binary operator.
I think it's reasonable for any experienced programmer to expect that any
binary operator will have a lower precedence than a unary operator.
What I wonder is why this operator is necessary at all? With this
ambiguity, it harms the readability, not improves it :/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120113/dffa1e05/attachment.html>


More information about the Digitalmars-d mailing list