<div dir="ltr">I do it :-)<div><br></div><div>Happy new year!</div><div><br></div><div>Cheers,</div><div>Karl</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 31, 2013 at 12:40 PM, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Hey, I wrote it, you make the workspace, deal? ;)</div><div><br></div><div>Happy New Year, btw.</div>
<span class="HOEnZb"><font color="#888888"><div><br></div><span style="font-size:12px">- Bert -</span></font></span><div><div class="h5"><div><div><span style="font-size:12px"><br></span></div><div><div>On 31.12.2013, at 12:37, karl ramberg &lt;<a href="mailto:karlramberg@gmail.com" target="_blank">karlramberg@gmail.com</a>&gt; wrote:</div>
<br><blockquote type="cite"><div dir="ltr">Make a Welcome Workspace with this info :-)<div><br></div><div>Cheers,</div><div>Karl</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 31, 2013 at 11:27 AM, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On 31.12.2013, at 08:53, David Holiday &lt;<a href="mailto:neuburge@rohan.sdsu.edu" target="_blank">neuburge@rohan.sdsu.edu</a>&gt; wrote:<br>


<br>
&gt; Is there a way to browse the ecosystem of objects in a Smalltalk image?<br>
<br>
</div>Yes, multiple ones in fact. This is a major reason working in Smalltalk feels more immediate than in other environments.<br>
<div><br>
&gt; I&#39;m not talking about the class browser, what I&#39;m looking for is a way to see what objects have actually been instantiated and what their state is.<br>
<br>
</div>The basic tool for this is called an Inspector. Whenever you have an expression, like &quot;3 + 4&quot;, you press cmd-i to &quot;inspect it&quot;, which opens an inspector on the result. This works in any text area. Try for example inspecting &quot;self&quot; in a class browser, and you will inspect the underlying class object (which the browser shows a high-level view of).<br>


<br>
In the Inspector you see the objects referenced by this object (via instance variables or indexed fields) in the left panel. Select any of them and choose &quot;inspect&quot; from the context menu (or press cmd-i again). This way you can inspect all the objects in the system.<br>


<br>
A more modern tool than the Inspector (which was around 40 years ago already) is the Object Explorer. It presents you a tree view of an object and its &quot;children&quot;, which again are the instance variables and indexed fields of the object. Open it with cmd-shift-i (or &quot;explore&quot; in the context menu).<br>


<br>
You can also do the reverse. If you choose &quot;objects pointing to this value&quot; you get an inspector showing all the objects that directly point to this object. Similarly there is a &quot;reverse explorer&quot;, which you can open by selecting &quot;explore pointers&quot;.<br>


<br>
There are two roots to all the objects in the system:<br>
<br>
        Smalltalk specialObjectsArray<br>
<br>
which basically holds everything the Virtual Machine needs to know about, and in turn almost every object in the whole image, and<br>
<br>
        thisContext<br>
<br>
which is the current execution context, holding onto temporary objects. When a garbage collection is performed, any object not reachable form either of these two roots is removed from memory.<br>
<br>
An &quot;interesting&quot; global object to explore is<br>
<br>
        Project current<br>
<br>
which holds your current workspace, in particular<br>
<br>
        Project current world<br>
<br>
, the root of all morphs in the world. And of course<br>
<br>
        Smalltalk<br>
<br>
itself is the dictionary that holds all global objects, including all classes (unless they are defined in a non-global environment).<br>
<br>
There is also a low-level way to enumerate all objects in memory. &quot;self someObject&quot; will return the very first object in memory (which happens to be the nil object), and &quot;anObject nextObject&quot; will return the next one:<br>


<br>
        | object count |<br>
        count := 0.<br>
        object := self someObject.<br>
        [0 == object]<br>
                whileFalse: [count := count + 1.<br>
                        object := object nextObject].<br>
        count<br>
<br>
Interestingly, this also finds objects that are due to be garbage-collected. For example, if you accidentally closed a text window, there is a good chance its contents will still be in memory, and can be retrieved using an expression like<br>


<br>
        ByteString allInstances last: 10<br>
<br>
This makes use of the someInstance/nextInstance methods, which are similar to someObject/nextObject, but restricted to instances of one class only.<br>
<br>
Hope you have fun poking around in the world of objects :)<br>
<span><font color="#888888"><br>
- Bert -<br>
</font></span><div><div><br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org" target="_blank">Beginners@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br></div>
_______________________________________________<br>Beginners mailing list<br><a href="mailto:Beginners@lists.squeakfoundation.org" target="_blank">Beginners@lists.squeakfoundation.org</a><br><a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>
</blockquote></div><div><span style="border-collapse:separate;border-spacing:0px;font-family:&#39;Lucida Grande&#39;;font-size:12px"><br></span>

</div>
<br></div></div></div></div><br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>