[nem-en] N.C.Hashtable behavior when the key is not found

NoiseEHC NoiseEHC at freemail.hu
Fri Apr 7 12:22:24 CEST 2006


Do the Right Thing (TM)

Michal Moskal wrote:
> Hi,
>
> Currently our Hashtable implementation, when the Item indexer is used,
> first checks if given key is in the underlaying S.C.G.Dictionary and
> if its not, it returns default value of given type. IMHO this is evil
> for several reasons:
> 1. S.C.G.Dictionary throws an exception in such case
> 2. the double check is bad performance-wise
> 3. it leads to hidden bugs, where you get default value instead of the exception
>
> I even assumed it would throw exception and always checked with
> Contains() first.
>
> Will anybody kill me dead when I change this to throw the exception?
>
> --
>    Michal Moskal,
>    http://nemerle.org/~malekith/
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>
>
>   



More information about the devel-en mailing list