<div dir="auto">From the name ToolSet, I understand that the goal was to provide several different sets of inspectorClass. Whether it is really usefull or not I don't know, but you are right, the implementation is ruining extensibility. A visitor pattern, inspectorClassForToolSet: aToolSet ^aToolSet inspectorClassForCompiledMethod could help if we really want programmable ToolSet. Do we?</div><div class="gmail_extra"><br><div class="gmail_quote">Le 5 févr. 2018 19:43, "Eliot Miranda" <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> a écrit :<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi All,<div><br></div><div>    I find this method broken and sad:</div><div><br></div><div><div>inspectorClassOf: anObject</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>"Answer the inspector class for the given object. The tool set must know which inspector type to use for which object - the object cannot possibly know what kind of inspectors the toolset provides."</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>| map |</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>map := Dictionary new.</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>#(</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">          </span>(CompiledMethod<span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">            </span>CompiledMethodInspector)</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">            </span>(CompositeEvent<span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">            </span>OrderedCollectionInspector)</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">         </span>(Dictionary<span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">                        </span>DictionaryInspector)</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>(ExternalStructure<span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>ExternalStructureInspector)</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">         </span>(FloatArray<span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">                        </span>OrderedCollectionInspector)</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">         </span>(OrderedCollection<span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>OrderedCollectionInspector)</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">         </span>(Set<span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">                                       </span>SetInspector)</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">               </span>(WeakSet<span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">                   </span>WeakSetInspector)</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>) do:[:spec|</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>map at: spec first put: spec last.</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>].</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>anObject class withAllSuperclassesDo:[:cls|</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">         </span>map at: cls name ifPresent:[:inspectorName| ^Smalltalk classNamed: inspectorName].</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>].</div><div><span class="m_-1788809431919252249gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>^Inspector</div><div><br></div><div>Is this really to be preferred over sending inspectorClass to the object?  This method is bad because it is a point of collision for anyone who wants to add a custom inspector.  Hence it creates unnecessary conflicts between packages, whereas implementing inspectorClass allows one to keep things separated.</div><div><br></div><div>The late binding/defaulting the use of the class name and classNamed: provides here could be achieved by implementing Object>>inspectorClassName just as easily as this hard-wired table.</div><div><br></div><div class="m_-1788809431919252249gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>
<br><br>
<br></blockquote></div></div>