<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 27 September 2017 at 22:01, jmh530 via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wednesday, 27 September 2017 at 07:41:23 UTC, Ilya Yaroshenko wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
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<br>
</blockquote>
<br></span>
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:<br>
<br>
struct Foo<br>
{<br>
    int data;<br>
}<br>
<br>
Foo opBinary!(string op)(Foo x, Foo y)<br>
{<br>
    return mixin("x.data" ~ op ~ "y.data");<br>
}<br>
<br>
That would mean you could also do something like:<br>
import lubeck : opBinary;<br>
</blockquote></div><br></div><div class="gmail_extra">Again, sadly, D has no ADL, and this will be an unmitigated disaster as a result!</div><div class="gmail_extra">Instantiations of templates will use the default elementwise operator instead of the one you specified in your module, and nobody will understand why.</div></div>