Argumnentation against external function operator overloading is unconvincing

Joseph Rushton Wakeling via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 22 16:25:31 PDT 2016


On Thursday, 22 September 2016 at 05:38:53 UTC, HaraldZealot 
wrote:
> So it seems to be essential point. But because we already have 
> the same problem with UFCS, I don't see why we should prohibit 
> external overloading of operator, it is just inequality (in 
> political sense) for operators :)

I'm not sure that it's fundamentally different from issues that 
can affect other functions.  I seem to remember running into some 
issues along these lines when I tried defining math functions 
(e.g. `cos`) to work with an `Imaginary` type I was trying to add 
to `std.complex`.

If you're writing generic math code and you want to take the 
cosine of a number whose type is not explicitly known, how do you 
know which `cos` to use?


More information about the Digitalmars-d mailing list