<div dir="ltr"><br><br><div class="gmail_quote">On Sat, Aug 9, 2008 at 10:25 AM, tim Rowledge <span dir="ltr">&lt;<a href="mailto:tim@rowledge.org">tim@rowledge.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
When Sets are created the array holding the values is of course filled with nils by the VM. Using any other object to signify &#39;this slot is empty&#39; would of course cost time to iterate over the array and fill each slot. Then for every grow it would cost more time to fill the new slots with this other distinguished value.</blockquote>
<div><br></div><div>No it _would not_. &nbsp;With a primitive that took the argument to fill with it would take no extra time. &nbsp;e.g.</div><div><br></div><div><span class="Apple-style-span" style="font-style: italic;">Behavior methods for instance creation</span></div>
<div><div><span class="Apple-style-span" style="font-weight: bold;">basicNew: sizeRequested&nbsp;withAll: defaultValue</span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;Primitive. Answer an instance of this class with the number of indexable</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>variables specified by the argument, sizeRequested, initialized with defaultValue.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>Fail if this class is not indexable or if the argument is not a&nbsp;positive Integer, or if</div>
<div><span class="Apple-style-span" style="white-space: pre; ">        </span>there is not enough memory available.&nbsp;Essential. See Object documentation whatIsAPrimitive.&quot;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&lt;primitive: NNN&gt;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>self isVariable ifFalse:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>[self error: self printString, &#39; cannot have variable sized instances&#39;].</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>(sizeRequested isInteger and: [sizeRequested &gt;= 0]) ifTrue:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>[&quot;arg okay; space must be low.&quot;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>OutOfMemory signal.</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>^ self basicNew: sizeRequested withAll: defaultValue &quot;retry if user proceeds&quot;].</div>
<div><span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="font-weight: normal; "><span class="Apple-tab-span" style="white-space:pre">        </span>self primitiveFailed</span></span></div>
<div><span class="Apple-style-span" style="font-weight: bold;"><br></span></div><div><span class="Apple-style-span" style="font-weight: bold;">new: sizeRequested withAll: defaultValue</span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;Answer an initialized instance of this class with the number of indexable</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp;variables specified by the argument, sizeRequested, and all indexable slots filled with defaultValue.&quot;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>^ (self basicNew: sizeRequested&nbsp;withAll: defaultValue) initialize</div>
<div><br></div></div><div><span class="Apple-style-span" style="font-style: italic;">Set methods for private</span></div><div><div><span class="Apple-style-span" style="font-weight: bold;">init: n</span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;Initialize array to an array size of n&quot;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>array := Array new: n withAll: self.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>tally := 0</div><div><br></div><div>and delete ArrayedCollection class&gt;&gt;new:withAll:</div>
<div><br></div><div><br></div><div>Throughout these conversations I&#39;m reminded of the song <a href="http://en.wikipedia.org/wiki/Little_Boxes">Little Boxes</a>... &nbsp;It would be nice to think outside of them occasionally...</div>
<div><br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">If you really, really, need a form of Set that can include nil as a useful object (for want of a better word) then make a new SetWithNils class or similar.</blockquote>
<div><br></div><div>Indeed. &nbsp;But before the standards committee comes down on us hard can we not discuss the concept first? &nbsp;Or are you still venting over _ being replaced with :=, or with:......with: being replaced with, gasp, horror, *curly braces* argh!!!! &nbsp;Ohhhh noooo, mister bill......</div>
<div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="Ih2E3d"><br>
<br>
tim<br>
--<br>
tim Rowledge; <a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>; <a href="http://www.rowledge.org/tim" target="_blank">http://www.rowledge.org/tim</a><br></div>
Fractured Idiom:- AMICUS PURIAE - Platonic friend<br>
<br>
<br>
<br>
</blockquote></div><br></div>