<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 4, 2015 at 1:40 PM, Chris Muller <span dir="ltr"><<a href="mailto:ma.chris.m@gmail.com" target="_blank">ma.chris.m@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">>> If #isDictionary refers to particular API and behaviors, one could<br>
>> argue that a BTree should answer true to #isDictionary, because it has<br>
>> similar API and behaviors. In the context of _equivalence testing_<br>
>> though, a BTree is not a Dictionary.<br>
>><br>
>> So as long as we interpret the various #isSomeType methods as truly of<br>
>> *that type* (same semantics as isKindOf:), and not "similar to", then<br>
>> I can see no side-effects (unless someone added #isDictionary to<br>
>> BTree, of course). However, we may want to visit the other #=<br>
>> implementations elsewhere in the system too, unless this would appear<br>
>> to be an inconsistency producing its own odor of sorts.<br>
><br>
> "similar to" is vague. I *don't* interpret isFoo methods as isKindOf: (and<br>
> think that most experienced Smalltalk programmers don't either).<br>
> In<br>
> Smalltalk type = protocol. So these methods imply that an object implements<br>
> a given set of messages, not that they are of any given class.<br>
<br>
</span>Then I am very interested to know your thoughts about my BTree<br>
question, above, which shares the same protocol as Dictionary. Should<br>
<br>
(BTree new at: 3 put: 'three'; yourself) = (Dictionary new at: 3<br>
put: 'three'; yourself)<br>
<br>
return true? Why or why not?<br></blockquote><div><br></div><div>Duck typing applies here, if it quacks like a duck. So if your BTree behaves like a Dictionary to the extent that e.g. MethodDictionary does (MethodDictionary supports associationAt: but isn't answering an association within it cuz it does't contain associations) then sure, it's a Dictionary.</div></div>-- <br><div class="gmail_signature">best,<div>Eliot</div></div>
</div></div>