[squeak-dev] Re: What is equivalence? (was: The Trunk:
ma.chris.m at gmail.com
Wed Feb 4 21:40:54 UTC 2015
>> If #isDictionary refers to particular API and behaviors, one could
>> argue that a BTree should answer true to #isDictionary, because it has
>> similar API and behaviors. In the context of _equivalence testing_
>> though, a BTree is not a Dictionary.
>> So as long as we interpret the various #isSomeType methods as truly of
>> *that type* (same semantics as isKindOf:), and not "similar to", then
>> I can see no side-effects (unless someone added #isDictionary to
>> BTree, of course). However, we may want to visit the other #=
>> implementations elsewhere in the system too, unless this would appear
>> to be an inconsistency producing its own odor of sorts.
> "similar to" is vague. I *don't* interpret isFoo methods as isKindOf: (and
> think that most experienced Smalltalk programmers don't either).
> Smalltalk type = protocol. So these methods imply that an object implements
> a given set of messages, not that they are of any given class.
Then I am very interested to know your thoughts about my BTree
question, above, which shares the same protocol as Dictionary. Should
(BTree new at: 3 put: 'three'; yourself) = (Dictionary new at: 3
put: 'three'; yourself)
return true? Why or why not?
More information about the Squeak-dev