[squeak-dev] Letting Set contain nils?

tim Rowledge tim at rowledge.org
Fri Aug 8 23:35:42 UTC 2008


Sets are defined as not holding nils. Changing that would mess up  
quite a bit of code I suspect.

Sets are sparsely populated arrays (around 40% IIRC) that use the nils  
to mark the unused slots. How do you imagine that we would mark unused  
slots (which are an important part of the whole sparse array thing) if  
nils were allowed? And how would you expect #do:/collect: etc to work   
- you would have to make all your blocks test for nil. Oh and how  
would code discriminate between nils you put in the array and nils  
that are put there by  the system for the sparseness management?

If you need Sets and want a distinguished value, make one. Just don't  
mess up the whole system in the process, eh?

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: RDR: Rotate Disk Right





More information about the Squeak-dev mailing list