<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="gmail-Apple-tab-span" style="white-space:pre"> </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="gmail-Apple-tab-span" style="white-space:pre"> </span>| map |</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>map := Dictionary new.</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>#(</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>(CompiledMethod<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>CompiledMethodInspector)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>(CompositeEvent<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>OrderedCollectionInspector)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>(Dictionary<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>DictionaryInspector)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>(ExternalStructure<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>ExternalStructureInspector)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>(FloatArray<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>OrderedCollectionInspector)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>(OrderedCollection<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>OrderedCollectionInspector)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>(Set<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>SetInspector)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>(WeakSet<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>WeakSetInspector)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>) do:[:spec|</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>map at: spec first put: spec last.</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>].</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>anObject class withAllSuperclassesDo:[:cls|</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>map at: cls name ifPresent:[:inspectorName| ^Smalltalk classNamed: inspectorName].</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>].</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </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="gmail_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>