About Dictionary includes

Chris Muller afunkyobject at yahoo.com
Wed Sep 15 14:56:57 UTC 2004


Dictionary's api already identifies the notion of an "Association" so I would
suggest an implementation of includesAssociation: rather than includesBinding:

includesAssociation: anAssociation
  ^ (myDictionary
      associationAt: anAssociation key
      ifAbsent: [ ^ false ]) value = anAssociation value

I just typed this up in the email, I haven't tested it, but the idea seems like
a worthy addition to Dictionary.

 - Chris

--- stéphane_ducasse <ducasse at iam.unibe.ch> wrote:

> But I cannot know whether I have a pair #lulu -> 3.
> For me a dictionary is a set that contains pairs and not only their 
> values.
> I may be wrong but what I put in a dictionary is not a single value but 
> a pair. For me
> #lulu -> 5 is not equal to #lulu-> 6. and if I want to know whether a 
> dictionary has a
> pair or binding I would like to use an includes: message.
> 
> > For me, the current includes: makes Dictionary consistent and 
> > compatible with
> > other collections.  You can know whether an object is included in an 
> > Array or
> > Dictionary without having to know which one you have.  That each of 
> > those
> > structures provides a different kind of key-access (integer-index vs.
> > object-key) is conveniently irrelevant.
> 
> 
> 
> 
> 
> 
> >
> > What is includesBinding:?
> >
> >  - Chris
> >
> 
> 




More information about the Squeak-dev mailing list