I came up with some code (see below) to help figure out the design of
complicated objects.
I'd like to reduce the method to only one parameter, but I don't know if
it's possible to do.

An example, showing how this can be used:

UITheme class >> exampleOtherControls has a large object (16 lines!), about
2/3rds down, that starts with:
   dialog newTitle: 'Expanders' for: (

which is one of the elements of inside this object (found way at the top)
        dialog contentMorph: (dialog newRow: {

What is that object?

Change it to:
   v1 :=    dialog newTitle: 'Expanders' for: (

And add this line at the end of the method:
   MyTool var: 'v1' class: v1. 

(Also must add v1 to the method's temporary variables:
        |dialog builder image emboss fuzzy v1 | )

Now run UITheme exampleOtherControls with a Transcript window open.
It shows this:

v1 - PanelMorph


-----------------

'From Pharo1.2 of 14 March 2011 [Latest update: #12341] on 29 March 2011 at
9:06:15 am'!
Object subclass: #MyTool
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'Sandbox'!

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

MyTool class
        instanceVariableNames: ''!

!MyTool class methodsFor: 'as yet unclassified' stamp: 'DougEdmunds
3/29/2011 08:52'!
var: aString class: anObject
        Transcript show: aString, ' - ', anObject class asString; cr.! !


--
View this message in context: 
http://forum.world.st/Show-a-variable-name-in-Transcript-tp3413379p3415532.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply via email to