Argumnentation against external function operator overloading is unconvincing

pineapple via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 22 03:38:22 PDT 2016


On Wednesday, 21 September 2016 at 19:01:40 UTC, Timon Gehr wrote:
> There is no technical reason that would make the implementation 
> of this feature difficult, if that is your question.
>
> Basically, the rationale is: external operators cannot be used 
> in generic code that does not import the module defining the 
> operators. C++ works around this using ADL. Walter 
> (justifiably) does not like ADL, hence the limitation.
>
> (I don't agree with that line of reasoning: obviously this is 
> not only an issue for operators, but for any UFCS function; 
> operators are mere syntactic sugar.)


The greatest offender I've found is how in phobos, arrays do not 
behave as ranges without importing the module defining their 
range operations.

Which I think is obnoxious, and maybe there's a solution to make 
both cases less so, but I definitely don't think it's an argument 
for exclusion.


More information about the Digitalmars-d mailing list