interfaces and contracts - new pattern

Adam D. Ruppe destructionator at gmail.com
Tue Dec 3 14:51:58 UTC 2019


On Tuesday, 3 December 2019 at 14:45:28 UTC, Ola Fosheim Grøstad 
wrote:
> Maybe also test with D interfaces? I suppose they have the same 
> behaviour as superclasses?

Yeah, I did that (there's a unittest in the blog source for it, 
that's what shows under the example section). It works nicely.

I just assumed a null contract in the parent was the same as 
in(true) and it isn't so ugh.

> Anyway, I think most programmers struggle with 
> covariant/contravariant parameters... I certainly have to stop 
> up and ponder for a while to figure out the semantics when 
> hitting such. So I tend to avoid it... :-P :-)

Maybe, but it is pretty sound once you get to know it.


More information about the Digitalmars-d-announce mailing list