<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">&lt;<a href="mailto:ma.chris.m@gmail.com" target="_blank">ma.chris.m@gmail.com</a>&gt;</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="">&gt;&gt; If #isDictionary refers to particular API and behaviors, one could<br>
&gt;&gt; argue that a BTree should answer true to #isDictionary, because it has<br>
&gt;&gt; similar API and behaviors.  In the context of _equivalence testing_<br>
&gt;&gt; though, a BTree is not a Dictionary.<br>
&gt;&gt;<br>
&gt;&gt; So as long as we interpret the various #isSomeType methods as truly of<br>
&gt;&gt; *that type* (same semantics as isKindOf:), and not &quot;similar to&quot;, then<br>
&gt;&gt; I can see no side-effects (unless someone added #isDictionary to<br>
&gt;&gt; BTree, of course).  However, we may want to visit the other #=<br>
&gt;&gt; implementations elsewhere in the system too, unless this would appear<br>
&gt;&gt; to be an inconsistency producing its own odor of sorts.<br>
&gt;<br>
&gt; &quot;similar to&quot; is vague.  I *don&#39;t* interpret isFoo methods as isKindOf: (and<br>
&gt; think that most experienced Smalltalk programmers don&#39;t either).<br>
&gt; In<br>
&gt; Smalltalk type = protocol.  So these methods imply that an object implements<br>
&gt; 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: &#39;three&#39;; yourself) = (Dictionary new at: 3<br>
put: &#39;three&#39;; 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&#39;t answering an association within it cuz it does&#39;t contain associations) then sure, it&#39;s a Dictionary.</div></div>-- <br><div class="gmail_signature">best,<div>Eliot</div></div>
</div></div>