<div>I noticed that the class comment for Set still thinks you can&#39;t stick nil in a set. I was going to update it, but I&#39;m a little confused about what&#39;s going on in #array. </div><div><br></div><div>#(#foo # bar #baz nil) asSet array</div>
<div><br></div><div>{nil . nil . nil . a SetElement . nil . #foo . #baz . nil . nil . nil . #bar}</div><div><br></div><div>Can I assume that the SetElement is a stand in for the nil item in the Set?</div><div><br></div><div>
See below for what I have so far.</div><div><br></div><div>=================================================</div><div><br></div><div>As of Squeak 4.1, Sets can contain nil.</div><div><br></div><div>I represent a set of objects without duplicates.  I can hold anything that responds to</div>
<div>#hash and #=.  My instances will automatically grow, if necessary,</div><div>Note that I rely on #=, not #==.  If you want a set using #==, use IdentitySet.</div><div><br></div><div>Instance structure:</div><div><br>
</div><div>  array<span class="Apple-tab-span" style="white-space:pre">        </span>An array whose non-nil elements are the elements of the set,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>and whose nil elements are empty slots.  There is always at least one nil.</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>In fact I try to keep my &quot;load&quot; at 75% or less so that hashing will work well.</div><div><br></div><div>  tally<span class="Apple-tab-span" style="white-space:pre">        </span>The number of elements in the set.  The array size is always greater than this.</div>
<div><br></div><div>The core operation is #findElementOrNil:, which either finds the position where an</div><div>object is stored in array, if it is present, or finds a suitable position holding nil, if</div><div>its argument is not present in array,</div>