Should we add `a * b` for vectors?

Dukc ajieskola at gmail.com
Thu Oct 5 10:23:17 UTC 2017


On Thursday, 5 October 2017 at 10:07:31 UTC, nkm1 wrote:
> Am I missing something? You can already extend the original 
> struct:
>
> extern(c) struct Crng
> {   int seedA;
>     int seedB;
>     ubyte[] restOfTheData;
>
>     extern (D) {
>         // or without extern (D)...
>         auto front() { return current(&this); }
>         void popFront() { toNextValue(&this); }
>     }
> }
>

Does that work? If so, good. But still not optimal, because you 
should be able to extend the functionality of code without 
changing it.

> Looks like what most people want are extension methods, not ADL?

We already have extension methods, but rather we want extension 
methods that work with other extension methods they don't know 
of. But I think that's what you meant and in this case the answer 
at least in my case is yes.

Unrelated: Since when have C struct had array members? I'm not so 
smart in my examples X).


More information about the Digitalmars-d mailing list