<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi all,<div><br></div><div>I've just uploaded a package to the Inbox for review by the community:</div><div><br></div><div><a href="http://source.squeak.org/inbox/Mirrors-cwp.2.mcz">http://source.squeak.org/inbox/Mirrors-cwp.2.mcz</a></div><div><br></div><div>It's a simple first step at creating a mirror API for Squeak. I've only implemented ObjectMirror and ObjectVmMirror, which provide high- and low-level reflection on an object. This implementation has a twist, however: it sends no messages to the object it's reflecting. That allows us to reflect on network proxies, ORM stubs, mock objects and the like without triggering any state changes.&nbsp;</div><div><br></div><div>As a proof of the concept, I've implemented a rudimentary non-invasive MirrorInspector. The main thing that's missing is non-invasive printing, which would take a bit of work to implement, but isn't necessary for a demo. To see it in action do try the following in a workspace.</div><div><br></div><div>WARNING: Read the comments carefully, and don't do this in an image you care about!</div><div><br></div><div><div><font class="Apple-style-span" face="Courier">"This creates a very dangerous object"</font></div><div><font class="Apple-style-span" face="Courier">Object subclass: #Nuke</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">        </span>instanceVariableNames: 'one two three'</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">        </span>classVariableNames: ''</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">        </span>poolDictionaries: ''</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">        </span>category: 'Test'.</font></div><div><font class="Apple-style-span" face="Courier">class := Smalltalk at: #Nuke.</font></div><div><font class="Apple-style-span" face="Courier">class superclass: nil.</font></div><div><font class="Apple-style-span" face="Courier">inst := class basicNew.</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">"This is harmless"</font></div><div><font class="Apple-style-span" face="Courier">MirrorInspector inspect: inst.</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">"This will crash your image"</font></div><div><font class="Apple-style-span" face="Courier">inst yourself.</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div></div><div>The implementation uses primitive 188 to directly execute CompiledMethods with the reflected object as the receiver, thus giving us access to the object's state without sending it a message.&nbsp;</div><div><br></div><div>So, what do you think?&nbsp;</div><div><br></div><div>Colin</div></body></html>