[Cuis-dev] Dictionary

Jonathan Kelly jonkelly at fastmail.fm
Thu Dec 31 19:00:41 CST 2015


Hi Phil,


On 01-Jan-16 11:32 AM, Phil (list) wrote:
> Jonathan,
>
> On Fri, 2016-01-01 at 09:47 +1100, Jonathan Kelly via Cuis-dev wrote:
>> On 01-Jan-16 6:47 AM, Phil (list) via Cuis-dev wrote:
>>>   
>>> An Association is just an implementation detail (i.e. the storage
>>> mechanism the Dictionary uses), all the Dictionary promises to do
>>> is
>>> store an arbitrary object given a distinct key value (as determined
>>> by
>>> #=), not distinct Associations.  It doesn't promise to use the
>>> Association, or even the key, you pass it.  This is actually what
>>> most
>>> people want it do do the majority of the time.  If what you need is
>>> distinctiveness test to be based on the key identity, then you use
>>> IdentityDictionary (which uses #==)  If you look at #scanFor: in
>>> both
>>> *Dictionary classes you'll see the difference and notice that
>>> neither
>>> one cares about the Association, only its key.  If what you are
>>> looking
>>> for is a collection of unique associations, then what you probably
>>> want
>>> to use is an IdentitySet for your associations.
>>>
>>>>    - Dan
>>>>
>>>>
>>>> _______________________________________________
>>>> Cuis-dev mailing list
>>>> Cuis-dev at cuis-smalltalk.org
>>>> http://cuis-smalltalk.org/mailman/listinfo/cuis-dev_cuis-smalltal
>>>> k.or
>>>> g
>>> _______________________________________________
>>> Cuis-dev mailing list
>>> Cuis-dev at cuis-smalltalk.org
>>> http://cuis-smalltalk.org/mailman/listinfo/cuis-dev_cuis-smalltalk.
>>> org
>> Have you heard of the term "defensive programming"?
>>
>> You've made a case, but how would anyone know that is the intended
>> (devalued) usage of Associations?
>>
> I had a long and opinionated piece ready to click send on but then I
> streamlined :-)
>
> I suggested the devalued status of methods dealing with Associations
> based on a previous experience in Cuis with Dictionary and Association.
>   It isn't officially devalued or deprecated, but 'feels' to me like
> something that could easily disappear at some point based on my
> previous experience.

If anyone is making book on that, I'll take a very large slice of 
"that's never going to happen". lol

Jonathan.



More information about the Cuis-dev mailing list