Will uniform function call syntax apply to operator overloads?

Robert Jacques sandford at jhu.edu
Tue Oct 12 19:22:56 PDT 2010


On Tue, 12 Oct 2010 17:08:16 -0400, Peter Alexander  
<peter.alexander.au at gmail.com> wrote:

> In short, when UFC is working on all types, will this be possible:
>
> Foo opBinary(string op)(Foo a, Foo b)
> {
>      return ...;
> }
>
> Foo x, y;
> Foo z = x + y;
>
> My reasoning here is that x + y is supposedly sugar for  
> x.opBinary!("+")(y), so the free opBinary defined above could be chosen  
> as a pseudo member of Foo.
>
> Will this be possible?

Unknown, but unlikely given how UFC for arrays work today: neither  
operator overloads nor templates are supported.


More information about the Digitalmars-d mailing list