4 ms·
Yes, it conflates a structural vs nominal type difference (i.e. punning 'bark'), with a classic variance issue. Ignore the tree. Suppose you have _seals_, who
by shellac 3y ago
Yes, it conflates a structural vs nominal type difference (i.e. punning 'bark'), with a classic variance issue.
Ignore the tree. Suppose you have _seals_, who are plausibly 'barkers' in the same sense as dogs. Take an array Dog[] and pass it to a function that accepts Barker[]. It seems reasonable to take a Barker from the array, nice and safe. But suppose we try to put a Seal into the array, that's not fine: it's a Dog[].
Famously java got this wrong, but runtime checks (somewhat) stop that being a disaster.