[Cuis-dev] Fw: Finding Instance specific behavior in the inspector

John McGarey johnmcgarey78 at yahoo.com
Sat Oct 23 10:57:29 PDT 2021

Thank you Phil B. Yes decompile worked perfectly.   
In my case from the inspector of the instance of WidgetMorph, I inspected the `properties` and from that inspector inspected the `#mouseButton1Up:localPosition: and from that inspector (which was an inspector on the block closure in question) I typed `self decompile` and got the decompiled bytecode that I expected which makes perfect sense now.  
Thank you!

   ----- Forwarded Message ----- From: Phil B <pbpublist at gmail.com>To: Discussion of Cuis Smalltalk <cuis-dev at lists.cuis.st>Cc: John McGarey <johnmcgarey78 at yahoo.com>Sent: Saturday, October 23, 2021, 12:35:07 PM CDTSubject: Re: [Cuis-dev] Finding Instance specific behavior in the inspector
 Hi John,
I think what you're looking for is #decompile.  For example, if in a workspace you printit on:
[true ifTrue: [Transcript show: 'testing']]
you will see:
[closure] in UndefinedObject>>DoIt 

However, if you printit on:
[true ifTrue: [Transcript show: 'testing']] decompile

you will get source code for the block:
 true ifTrue: [ Transcript show: 'testing' ]. ]}
One thing to keep in mind is that it is decompiling from bytecode so you will lose things like comments and variable names but it will otherwise be identical to the original source code.

On Sat, Oct 23, 2021 at 1:05 PM John McGarey via Cuis-dev <cuis-dev at lists.cuis.st> wrote:

   I'm on chapter 6 in the Cuis book and in Figure 6.8 there are a few lines of code that add behavior to just one instance of WidgetMorph.  It actually works great but I got curious and was surprised when I went to look at that code in the inspector and couldn't find it.  All I could find was the word `[closure]` in the place of the block but I bet someone here can do better:   
Does any genius here know a tricky or roundabout way to see that block of code after it has been applied? 
Thank you,John
Reproducing this:Cuis5.0-4928Create a new WidgetMorph and inspect it and then put these two lines in the inspector:`self setProperty: #handlesMouseDown: toValue: true.self setProperty: #mouseButton1Up:localPosition: toValue: [:ignoredEvent :ignoredPosition| self color: Color random]self hasProperty: #mouseButton1Up:localPosition:`from p94/95 of The Cuis Book-- 
Cuis-dev mailing list
Cuis-dev at lists.cuis.st

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20211023/5b806f9f/attachment-0001.htm>

More information about the Cuis-dev mailing list