Will uniform function call syntax apply to operator overloads?

Peter Alexander peter.alexander.au at gmail.com
Tue Oct 12 16:55:31 PDT 2010


On 13/10/10 12:15 AM, Jonathan M Davis wrote:
> Personally, I do _not_ think that overloaded operators should work with uniform
> function syntax, if for no other reason than because it doesn't actually look
> like the uniform function syntax does. There is no . operator directly involved.
> And I don't see any real value in overloaded operators which aren't part of the
> type. Unlike C++, I don't think that we have any operators where having an
> overloaded operator function be a member function is a problem (the classic
> operators with that problem being>>  and<<).
>
> - Jonathan M Davis

The way I see things, one of the main purposes of uniform function call 
is so that you can extend structs/classes from 3rd party libraries (i.e. 
someone else has defined a class, and you want to add an operator 
without modifying the source file).

If I can add any other member function using UFC, I don't see why I 
shouldn't be able to add operator overloads. It's just an unnecessary 
inconsistency not to allow them.



More information about the Digitalmars-d mailing list