Earlier quoted context omitted.
I know of atleast one instance in C# where something like this happens. The IEnumberable .Count() extension sees if the input is actually a ICollection and uses the count on that to get the count directly, rather than iterating over it. I remember writing extension methods in C# for IEnumerable , which would of course take in an IEnumerable , but saw if the actual input was a ICollection , IList etc to optimize the o…
This is not the same thing. The problem with the Go implementation is essentially that the method is semantically different from the expected method. Closing a stream is semantically different from not closing a stream. It just is. The Go method was just wrong . The problem was not the type introspection. There's nothing wrong with us attempting to do optimization for ICollection`1 or the rest of the collection inter…
No-one is arguing about the Close() case. However, the io.Copy() case is comparable to the IEnumerable.Count() implementation.