<br><br><div class="gmail_quote">On Wed, Nov 11, 2009 at 3:56 PM, Igor Stasenko <span dir="ltr"><<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
@Levente..<br>
there is no need to introduce a 'containsNil' flag, nor use other than<br>
nil filler object.<br>
The tally ivar, which is already there can be used to reflect if set<br>
contains nil:<br>
<br>
tally >= 0 - set contains tally number of elements without nil<br>
tally == -1 - set contains only single element - nil<br>
tally < -1 - set contains a (tally abs) number of elements including nil<br>
<br></blockquote><div><br></div><div>Neat. It might be even easier to use floating point to indicate nil :)</div><div>So if</div><div> tally class = SmallInteger</div><div>it doesn't include nil, but if</div>
tally class = Float</div><div class="gmail_quote">it does. Once tally has been set to a Double all the loops still work, increasing the tally still works, etc.</div><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
i can implement it, if you want.<br>
<br>
The number of changes is quite minimal, and won't make image to die<br>
violently, because:<br>
- currently all sets having tally >=0, so even if you change things<br>
to support nils as i proposing, no existing sets having chances to<br>
behave differently<br>
- currently all sets can't meaningfully include nil, and there is no<br>
code which intentionally puts nil in sets, because it leads to error.<br>
<br>
2009/11/12 Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>>:<br>
<div><div></div><div class="h5">><br>
><br>
> On Wed, Nov 11, 2009 at 3:14 PM, Russell N Hyer<br>
> <<a href="mailto:hrothgar.ofstingan@gmail.com">hrothgar.ofstingan@gmail.com</a>> wrote:<br>
>><br>
>> I still don't comprehend the purpose behind having more than one<br>
>> flavour of empty in regards to empty set based mathematics.<br>
><br>
> nil is an object like any other, and Sets can contain arbitrary objects.<br>
> An empty Set contains no objects. The fact that internally an empty Set has<br>
> some slots intialized to nil is an implementation detail that in no way<br>
> implies that it contains nil.<br>
> So if sets are capable of including arbitrary objects they should be able to<br>
> contain nil. There are lots of contexts in which having collections that<br>
> can include nil is useful. The compiler is one. Storing and reconstituting<br>
> object graphs is another.<br>
> Or in summary nil ~~ #isEmpty.<br>
> HTH<br>
> Eliot<br>
>><br>
>> 2009/11/11, Igor Stasenko <<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>>:<br>
>> > Just want to add that enabling a set to contain nils already discussed<br>
>> > before.<br>
>> ><br>
>> ><br>
>> > <a href="http://n4.nabble.com/squeak-dev-Letting-Set-contain-nils-td69437.html#a69437" target="_blank">http://n4.nabble.com/squeak-dev-Letting-Set-contain-nils-td69437.html#a69437</a><br>
>> ><br>
>> > ... and as you may guess, i supporting Levente in this :)<br>
>> ><br>
>> > --<br>
>> > Best regards,<br>
>> > Igor Stasenko AKA sig.<br>
>> ><br>
<br>
<br>
<br>
</div></div>--<br>
<div><div></div><div class="h5">Best regards,<br>
Igor Stasenko AKA sig.<br>
<br>
</div></div></blockquote></div><br>