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

Michal Moskal michal.moskal at gmail.com
Fri Apr 7 09:21:51 CEST 2006


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/



More information about the devel-en mailing list