[squeak-dev] Re: Ideas about sets and dictionaries

Igor Stasenko siguctua at gmail.com
Thu Nov 12 02:03:56 UTC 2009


2009/11/12 Andreas Raab <andreas.raab at gmx.de>:
> Eliot Miranda wrote:
>>
>> Neat.  It might be even easier to use floating point to indicate nil :)
>> So if
>>        tally class = SmallInteger
>> it doesn't include nil, but if
>>        tally class = Float
>> it does.  Once tally has been set to a Double all the loops still work,
>> increasing the tally still works, etc.
>
> Ouch! Can we please step back a little and instead of coming up with ever
> more clever hacks think a bit about how we'd solve the problem if we would
> address it from first principles? Nothing against cool hacks but that is
> getting so obscure that I'd rather not have nil in sets at all than having
> to live with the hacks that have been proposed.
>
> Seriously, how *would* you address this problem if you weren't trying to
> make it fit exactly?
>

err.. you don't mind, if i remind you that there a lot of ugly hacks
around , like compact classes,
implicit message sends (#class , #==) and nobody saying a word against
them, #ifTrue:ifFalse: inlining
instead of true message send and finally immediate objects -
smallintegers which you can't subclass?!?!

Do you really think that way how to represent the presence of nil in
set worst than the listed above?

In attachment a changeset which allow nils to have sets.. or sets to
have nils.. whatever :)

All tests in CollectionTests are green except one unrelated
(ArrayTest>>testPrinting)

> Cheers,
>  - Andreas
>
>



-- 
Best regards,
Igor Stasenko AKA sig.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sets-with-nils.1.cs
Type: application/octet-stream
Size: 2503 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20091112/478c9f89/Sets-with-nils.1.obj


More information about the Squeak-dev mailing list