https://issues.dlang.org/show_bug.cgi?id=15288

Dennis <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]
           Hardware|x86_64                      |All
                 OS|Linux                       |All
           Severity|normal                      |enhancement

--- Comment #2 from Dennis <[email protected]> ---
-2^2 in math evaluates to -(2^2) = -4, not (-2)^2 = 4. This is fairly
consistent in e.g. Wolfram Alpha, Google search's calculator, Python (`-2**2`
in that case) etc. So I think it's good that D also has -2^^2 = -4. It makes
less sense for the cast operator or pointer operators I agree, but do you
really want to add another precedence level for that? To me, that sounds like
it would only complicate things more. At least now you know the precedence of
every unary operator is the same.

--

Reply via email to