Comment

Comment by branko_d

Why? It's just a property of type transformation.

Assuming Parent <- Child ("<-" denotes inheritance):

- If Generic<Parent> <- Generic<Child>: it's covariant.

- If Generic<Parent> -> Generic<Child>: it's contravariant.

- Otherwise: it's invariant.

Or at least it's that straightforward in C#. Are there complications in Rust?

parent branko_d 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton