contravariant argument types: wanna?

Walter Bright newshound1 at digitalmars.com
Wed Sep 23 02:33:34 PDT 2009


Andrei Alexandrescu wrote:
> Today D does not support contravariant arguments, but Walter told me 
> once he'd be quite willing to implement them. It is definitely the right 
> thing to do, but Walter would want to see a compelling example before 
> getting to work.

The stumbling block to contravariant parameters (not arguments) is how 
it throws a monkey wrench into the overloading rules. The problem is 
deciding if a function overrides or overloads, when its parameter types 
are different.

The current rule is simple: if the parameter types are identical, it 
overrides. If they are not identical, it overloads.



More information about the Digitalmars-d mailing list