[Mono-devel-list] Some patches for Collection

Ben Maurer bmaurer at ximian.com
Thu Feb 17 07:20:56 EST 2005


Hey,

On Thu, 2005-02-17 at 12:03 +0100, Martin Baulig wrote:
> On Tue, 2005-02-15 at 01:18 +0900, Kazuki Oikawa wrote:
> 
> > Array.diff, SortedList.diff, Stack.diff
> > These patches fix the problem of returning wrong result in IndexOf and such method.
> 
> Hi,
> 
> the patches are all wrong.
> 
> One can argue which way around is best, but that's something which is
> decided when that method is written the first time.
> 
> I clearly will not accept any patch which is just trying to work around
> or hide a bug in someone's code.
> 
> What you're trying to do with your patches is changing a.Equals (b) to
> b.Equals( a) - which means that you have a fundamental design problem in
> your code.

We get bugs like this reported every so often. It is pretty clear that
there is production code relying on the thing.

I don't like it one bit, but I'd rather not get get the bug again.

The issue seems to be that because there was no Find (array, predicate),
where predicate is a Predicate <T>, people relied on using two different
types.

In theory we should thus be able to ignore this problem in generics.
However, because code that used IndexOf might now use IndexOf<T>, it
seems logical to keep compat with the old code.

-- Ben




More information about the Mono-devel-list mailing list