#= and Dictionary, etc.
Mike Klein
mike at twinsun.com
Wed Jan 21 00:54:34 UTC 1998
Just to throw another option into the mix, how about using the
identity of bindings:
i.e.
Dictionary>>
= other
othersAssociations := IdentitySet with: others associations.
self associations do: [ :selfAssociation |
othersAssociations remove: selfAssociation ifAbsent: [^false]].
^othersAssociations isEmpty
-- Mike Klein
> From: Patrick Logan <patrickl at servio.gemstone.com>
>
> A few people here at Gemstone just finished a hallway discussion on
> what #= should do for Dictionary. In particular should the values as
> well as the keys be #= or should they be #== in order for the
> Dictionary to be #=?
>
> Squeak derives Dictionary from Set and uses Set>>= which means values
> as well as keys only have to be #= and not #==.
>
> VisualWorks and VisualAge never redefine #= so a Dictionary is #= to
> another iff it is #==.
>
> I would be interested in some historical perspective or the
> perspective of other Squeakers.
>
> BTW Gemstone has the same behavior as Squeak, although it does not
> derive Dictionary from Set. This led to practical problems of
> cycles between values and the dictionaries that contain them. Squeak
> has the same problem. So Gemstone has to resolve the issue to
> avoid stack overflows.
>
> I personally would define Dictionary>>= to test for equality of keys
> but identity of values.
>
> The ANSI proposal does not say anything about #= in its definition of
> <AbstractDictionary> protocol. (Likely due to the various behaviors of
> the current vendors.)
>
> --
> Patrick Logan mailto:patrickl at gemstone.com
> Voice 503-533-3365 Fax 503-629-8556
> Gemstone Systems, Inc http://www.gemstone.com
More information about the Squeak-dev
mailing list
|