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

Phil B pbpublist at gmail.com
Sat Oct 23 10:34:55 PDT 2021


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.

Thanks,
Phil



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

> HI!
>
>    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-4928
> Create 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
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20211023/4777b554/attachment.htm>


More information about the Cuis-dev mailing list