<div dir="ltr"><br><br><div class="gmail_quote">On Sun, Aug 10, 2008 at 2:29 AM, stephane ducasse <span dir="ltr">&lt;<a href="mailto:stephane.ducasse@free.fr">stephane.ducasse@free.fr</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Eliot<br>
<br>
It would be great if we could have such nice primitive. Do you plan to add it in COG. I hope so.</blockquote><div><br></div><div>I shall do. It is straight-forward.&nbsp;</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
<br>
Stef<div><div></div><div class="Wj3C7c"><br>
<br>
On Aug 9, 2008, at 9:15 PM, Eliot Miranda wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
On Sat, Aug 9, 2008 at 10:25 AM, tim Rowledge &lt;<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>&gt; wrote:<br>
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.<br>

<br>
No it _would not_. &nbsp;With a primitive that took the argument to fill with it would take no extra time. &nbsp;e.g.<br>
<br>
Behavior methods for instance creation<br>
basicNew: sizeRequested withAll: defaultValue<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;Primitive. Answer an instance of this class with the number of indexable<br>
 &nbsp; &nbsp; &nbsp; &nbsp;variables specified by the argument, sizeRequested, initialized with defaultValue.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Fail if this class is not indexable or if the argument is not a positive Integer, or if<br>
there is not enough memory available. Essential. See Object documentation whatIsAPrimitive.&quot;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;primitive: NNN&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;self isVariable ifFalse:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[self error: self printString, &#39; cannot have variable sized instances&#39;].<br>
 &nbsp; &nbsp; &nbsp; &nbsp;(sizeRequested isInteger and: [sizeRequested &gt;= 0]) ifTrue:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[&quot;arg okay; space must be low.&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OutOfMemory signal.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^ self basicNew: sizeRequested withAll: defaultValue &quot;retry if user proceeds&quot;].<br>
 &nbsp; &nbsp; &nbsp; &nbsp;self primitiveFailed<br>
<br>
new: sizeRequested withAll: defaultValue<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;Answer an initialized instance of this class with the number of indexable<br>
 &nbsp; &nbsp; &nbsp; &nbsp; variables specified by the argument, sizeRequested, and all indexable slots filled with defaultValue.&quot;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;^ (self basicNew: sizeRequested withAll: defaultValue) initialize<br>
<br>
Set methods for private<br>
init: n<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&quot;Initialize array to an array size of n&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;array := Array new: n withAll: self.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;tally := 0<br>
<br>
and delete ArrayedCollection class&gt;&gt;new:withAll:<br>
<br>
<br>
Throughout these conversations I&#39;m reminded of the song Little Boxes... &nbsp;It would be nice to think outside of them occasionally...<br>
<br>
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.<br>
<br>
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......<br>

<br>
<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>
Fractured Idiom:- AMICUS PURIAE - Platonic friend<br>
<br>
<br>
<br>
<br>
<br>
</blockquote>
<br>
<br>
</div></div></blockquote></div><br></div>