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

Igor Stasenko siguctua at gmail.com
Thu Nov 12 06:26:04 UTC 2009


2009/11/12 Andreas Raab <andreas.raab at gmx.de>:
> Igor Stasenko wrote:
>>
>> A simple illustration:
>>
>>  set := Set new.
>>  Object allInstancesDo: [:obj | set add: obj ]   "using 'Object new'
>> as filler, right?"
>>
>> we could argue very long why one would want to do that, but the fact
>> is clear: your proposal have nothing
>> to offer to developer how to get around that.
>
> Don't use Object then. Use instances of EmptySetMarkers. That way you know
> that when adding instances of EmptySetMarkers to sets that have been
> previously created will cause problems. And if you want to enumerate those
> in a Set use a different marker explicitly, i.e.,
>
> set := Set withMarker: MyPrivateSetMarkerThatIsUsedNowWhereElse.
> EmptySetMarker allInstancesDo:[:obj | set add: obj].
>
> (seriously, Igor, this is not a good line of argumentation, the problems you
> are describing simply do not exist in practice)
>

it doesn't exists in practice in same way as you can't find any set in
current image which would respond true
on #includes: nil, nor any code which will make an attempt to include
nil in set, except tests maybe.
But once we remove such obstacle, i am sure they will appear.

In same way one could write a method and say: guys here the method
which adds two numbers. But be careful, adding 0 to any other number
will lead to error.
And guess what? You will see no uses in practice, where people adding
0 to number, instead they will write everywhere:

a = 0 or: [b =0 ] ifFalse: [ ^ a + b ].
a = 0 ifTrue: [ ^ b].
^ a

or something similar...


> Cheers,
>  - Andreas
>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list