On 13 January 2012 21:24, Grue <[email protected]> wrote: > ** > > > The logic is that the precedence in the language matches the >> precedence of a written equation. >> > > But the operator looks nothing like the written equation... nothing at all > like the written equation. > Perhaps D could support the unicode characters '²' '³' or 'ª' as kinda > handy operators. But to me, the operator looks NOTHING like maths notation, > and it would never have occurred to me that the operator was trying to > emulate maths notation (and by extension, its precedence rules). > I'd be interested to see a poll, and how many people see it one way or the > other... > > > Beware... your statement has awoken an "Ancient Forum Lurker"! ;) >
Sweet! I have that effect :P > 1. Google -5^2, result: -(5^2) = -25 > 2. Start ancient TI graphing calculator(which by the way has a special > unary (-) minus operator). > -5^2 = -25 > -5*²* = -25 > > The list can be extended by a great number of examples of prior convention > for the pow operator(especially in mathemathical software)... not just > Python... I have actually never even seen a valid counter example... > changing this would greatly confuse people with mathematical background. > In my prior post I agreed, though that said, I still maintain that none of those exampled look sufficiently like -5 ^^ 2 by my mind to be considered 'the same thing'. The single ^ and your not using spaces on either side distinguish it quite clearly... If it weren't for participation in this debate, I would have never clarified this in my mind personally, I can say that with confidence. The ^ xor operator was already taken. Promotion of a 'common' (arguable...) function to an operator can only be justified by improving code clarity... I don't think there's any evidence that it does that. It's funny, I've written a lot of maths code (mostly physics and/or rendering/lighting), but I can probably count the number of times I've used pow() on one hand. I use sqrt(), but I think that's a fairly well established subset of pow(), and people would never use ^^ to perform a sqrt. A function of that rarity possibly doesn't warrant a custom operator :) >
