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

d d at hell.art.pl
Fri Apr 7 14:24:02 CEST 2006


On Apr 7, 2006, at 9:21 AM, Michal Moskal wrote:

> 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?

  It would obviously be the right thing to do (changing the  
implementation, not killing you that is), but I'd make sure anyone,  
who already relies on the old way, finds out soon enough - not by  
unexpected bugs in their code, but perhaps a compiler warning, or at  
least a news item/blog entry or sth :-d

d

--
https://hell.art.pl == terror.org.pl == terror.icm.edu.pl/~d/gpg



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : /mailman/pipermail/devel-en/attachments/20060407/a13b375f/PGP.bin


More information about the devel-en mailing list