Ary Borenszweig wrote:
bearophile wrote:
5 ^^ 2 doesn't work yet, I guess it's not implemented yet.
But what do I have to import from math to use 5.2 ^^ 2 ?
Anyway, the need to explicitly import something to use a built-in operator like ^^ looks like a bad idea.

A very bad idea indeed! The idea is to save keystrokes...

Can't "import std.math : pow;" be added to the current module when this is needed?

I'll just explain the situation here. I provided a patch to DMD for opPow, with ^^. The patch was very minimal, since I did not know if Walter would accept it. It's not worth putting a whole lot of effort into something which will just be rejected (and it has less chance of acceptance if it is complicated). In the end, he did include the patch, though without opPowAssign.

I did the absolute bare minimum required to get ^^ working. In my patch, I clearly stated that the requirement to include std.math.pow is temporary. BTW, One of the nice things about ^^ is that we will finally be able to do integer powers without necessarily using floating-point. All kinds of stuff is still missing. a ^^ b won't be constant-folded, for example. It's desperately important that the language spec becomes stable before Andrei's book comes out. That leaves only a couple more releases left in D2 where features can be added. Some, like this one, will have rough edges. Don't think of it as fully implemented feature.

Reply via email to