PROPOSAL: Operator overloading by static member function

Janice Caron caron800 at googlemail.com
Sun Oct 14 01:57:58 PDT 2007


On 10/14/07, Reiner Pope <some at address.com> wrote:
> But you don't actually need static opMul for that. To quote two lines of it:

That's true. Put like that, static opAdd(), static opSub(), etc., do
start to sound a bit silly. I can't see why you would ever need to
write:

x = A + y;

where A was a type. Surely, any time you can imagine a use for that,
you could probably do the same thing with A just being a variable?

(The only one I can think of that has any real use is static opCall()
-- and even that need would disappear if structs had constructors)



More information about the Digitalmars-d mailing list