covariance of 'out' parameters is crucial for polymorphism and function subtyping

Walter Bright newshound2 at digitalmars.com
Fri Mar 9 22:26:06 PST 2012


On 3/9/2012 4:59 PM, Boscop wrote:
> It is crucial for function subtyping, because functions are only contravariant
> in their 'in' parameters, but covariant in their 'out' parameters and return type.
> Function subtyping matters not only in classes with methods that have 'out'
> parameters but also when assigning functions to function pointers or passing
> functions as argument to other functions.

I agree that this should be implemented.


More information about the Digitalmars-d mailing list