On Apr 9, 2008, at 03:06, Michael Poole wrote:
I agree with the test of "can I substitute Y objects whenever X
objects are used?", but I don't follow -- in your example -- under
which circumstances I would be unable to substitute IList<B> wherever
IList<A> is expected.
Suppose you receive an IList<A> and try to append an instance of A to
it. This operation is only valid on an instance of IList<B> if the
new object is also an instance of B. There are probably other
instances of why covariance cannot cross container boundaries, but
that is an easy one to remember.
Yeah. I get that. It was one of the examples in the previous mail. I
would, however, be willing to accept the risk in exchange for the
increase in expressiveness. I'm taking issue with the line that "if
it's not 100% statically provable, then it doesn't go in", regardless
of how useful it would be. Plus, as mentioned in a link up-post,
there are ways of getting around the provability problems as well.
That's all I'm saying.
--
Marco Von Ballmoos
http://earthli.com - Home of the earthli WebCore; PHP web sites made
simple.