May 06, 2007
Bruno Medeiros wrote:
> Hum, good point. This looks like an unprecedented case, I don't know if any other languages have reverse operator overloading like D.

Rubbish.  Python does as well, and for precisely the same reason I suspect D does: non-commutative operations, and working with existing, closed types.  For instance, if you have a pre-existing, closed vector class, and you want to write a matrix class that works with it, you need to overload both opMul and opMul_r, or it won't work.  I'd argue that any language that *doesn't* let you write the reverse operation is doing a pretty half-arsed job of operator overloading...

Hell, I wrote vector and matrix structs from scratch, and I did it that way since having two templates depend on each other causes MORE than enough problems... I'm not entirely sure I fixed the data corruption issue it was causing, and I'd really rather not wrangle with that again.

	-- Daniel

-- 
int getRandomNumber()
{
    return 4; // chosen by fair dice roll.
              // guaranteed to be random.
}

http://xkcd.com/

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/
May 07, 2007
Bruno Medeiros wrote

> In any case a design decision would have to be made

There is at least one more such decision to be made.

But what are they worth when it is anticipated, that the hardware will be able to evaluate complex expressions if there are no evaluation orders to be followed.

-manfred
1 2 3 4 5
Next ›   Last »