Sets with distinct entries (Was: Re: [squeak-dev] Re: Ideas about sets and dictionaries)

Igor Stasenko siguctua at gmail.com
Fri Nov 13 22:43:02 UTC 2009


2009/11/12 Tobias Pape <Tobias_Pape at gmx.de>:
> Hello —,
> Am 2009-11-12 um 12:11 schrieb Igor Stasenko:
>
>> a SetElement class then is a one-inst-var object, holding a reference
>> to proxied object, and
>> needs to properly implement #hash #= , required by Set.
>> Also, at each place where we need to feed a real object , a Set should
>> send an #unwrap (or give more distinct selector name)
>> to return enclosed object.
>
> probaly, the folowing would also be possible:
>
> for all, except the “special” object,
>
> #asSetElement
>
>        ^ self
>
> the other two shall return an actual wrapper.
>
> this shall retrun the actual entry upon called #value:
>
> #value
>
>        ^ wrappedEntry
>
> Then, to obtain an entry , it would be called
> asking for its #value.
>
> Problem then: Blocks :)
>

not only with block, but with anything else, which implements #value
differently.
This is why i took completely different message selectors for that
(#asSetElement and #enclosedSetElement)

> so long,
>        -Tobias
>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list