Argumnentation against external function operator overloading is unconvincing

jmh530 via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 21 12:40:08 PDT 2016


On Wednesday, 21 September 2016 at 19:01:40 UTC, Timon Gehr wrote:
>
> Basically, the rationale is: external operators cannot be used 
> in generic code that does not import the module defining the 
> operators.

So why not have the struct/class explicitly import external 
operators? You can do this currently with a separate module 
defining them and then the struct/class imports the whole thing. 
Kind of annoying, but would get the job done, no?

Alternately, you could invent some new syntax. Maybe something 
like

import this : Matrix plus(Matrix A, Matrix B);




More information about the Digitalmars-d mailing list