Should we add `a * b` for vectors?

jmh530 john.michael.hall at gmail.com
Wed Sep 27 12:01:34 UTC 2017


On Wednesday, 27 September 2017 at 07:41:23 UTC, Ilya Yaroshenko 
wrote:
>
> I would prefer outer operator overloading be added to D instead 
> of type wrappers. So a user can import a library for 
> operations, rather then library of wrappers. --Ilya

This might be a step in the right direction. It doesn't need to 
be full-blown extension methods/partial classes. Just the ability 
to treat operator overloading like free-standing functions (with 
power of UFCS). Something like:

struct Foo
{
     int data;
}

Foo opBinary!(string op)(Foo x, Foo y)
{
     return mixin("x.data" ~ op ~ "y.data");
}

That would mean you could also do something like:
import lubeck : opBinary;


More information about the Digitalmars-d mailing list