4 ms·
The semantics of ICollection<T>.Count and IList<T>.Count are well defined and known to you at the time your write your extension method. You don't know the sem
by ajanuary 13y ago
The semantics of ICollection<T>.Count and IList<T>.Count are well defined and known to you at the time your write your extension method.
You don't know the semantics of a method of an arbitrary type you've been passed in just because it has the same name. Go plays fast and loose with this idea, but at least the interface type of the argument should document "I'm expecting these methods to have a particular semantics". If they don't, that's then your fault.
- manojlds 13y agoThe Go dev has acknowledged that this is a bug, but also pointed out why something like this was done elsewhere ( io.Copy ), and the Count example was pointed at that.