opDispatch and alias this

Steven Schveighoffer schveiguy at yahoo.com
Tue Jun 26 16:16:16 UTC 2018


On 6/25/18 7:13 PM, Seb wrote:
> Apparently three years ago it was we decided to ban alias this and 
> opDispatch in the same class.
> What are your thoughts on this now?
> Is anyone depending on using alias this + opDispatch together like e.g. 
> in https://github.com/dlang/phobos/pull/6596?

My thoughts are that opDispatch should work with single or multiple 
alias this, and we should not deprecate the combination at all.

Why would opDispatch be treated any differently than the function that 
would be used with that name? Why are operator overloads not banned, 
they work the same way? The DIP mentions competing mechanisms of 
subtyping, but opDispatch isn't subtyping (it can be used to mimic 
another type, but doesn't allow the type to be considered as a base type).

-Steve


More information about the Digitalmars-d mailing list