A Huge Bummer When Using alias this

Jerry via Digitalmars-d digitalmars-d at puremagic.com
Thu Mar 24 16:02:49 PDT 2016


On Thursday, 24 March 2016 at 22:52:20 UTC, Jack Stouffer wrote:
>
> You just illustrated my point exactly. This doesn't scale, you 
> can't create special rules for every type when you're writing a 
> library. Nullable is aliased to the get function, which returns 
> int in this case. YOU SHOULDN'T HAVE TO DO THIS.
>
> This is the exact use case of alias this and it doesn't work.

My intuition tells me some sort of ducktyping should be possible 
here.
Check out

     https://code.dlang.org/packages/quack

or else you could define some primitives like isInputRange
eg. SupportsMath(T) or whatever which I guess is what quack is 
doing.


More information about the Digitalmars-d mailing list