[Newbies] Re: >> notation

Jerome Peace peace_the_dreamer at yahoo.com
Sat Dec 2 07:14:11 UTC 2006

[Newbies] >> notation
Hi Dave,

Your being great.

I'm learning a lot from following this thread. Thanks
for raising the questions persistantly.

(Did this using a fresh 3.9 7067)

In a workspace try evaluating (with doit or print it)

Object>>#doesNotUnderstand:) inspect . 
an inspector will pop up. 
Select all bytecodes and see what a squeak method is
made of.

To make things in squeak using a browser first get a
In the work space type Object
select t and type cmd-b (I'm on a mac translate what I
say for your platform)
a system window labeled 'System Browser: Object'.
In the second column Object is highlighted.
Position the mouse over it and Option-click. ( a menu
pops up) 
select 'more...' and then subclasstemplate.
In the big text pane at the bottom you will see::
Object subclass: #NameOfSubclass
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Kernel-Objects'

modify this to:
Object subclass: #MyClass
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'DavesStuff'

Mouse over what you have written and option-click to
get the menu
from the menu select 'accept it'

You have now defined a class myclass.
In the third column select --all--

Now  the big text pane at the bottom says:

message selector and argument names
	"comment stating purpose of message"

	| temporary variable names |

modify that to:

	"heres what to do"
array := Array new: 3.
array at: 1 put: 2. 

and accept it (see above)

first a box comes up asking for your initials type
them in and click accept.
second a menu comes up asing about what to do with
select 'declare temp'

you have now defined the method MyClass>>doThis.

Going back to the workspace type

myInstance := MyClass new .

myInstance doThis

select both lines and option-click from the menu
select 'print it'

you will see the result highlighted it will say a

thats because the instance as written does not
explicitly return a value.
so it is returning the receiver. 
the receiver is the instance of MyClass which we
stored in myInstance.

go back to the browser
add to the end of the method the line


go back to the workspace and do the 'print it' again
for the same text selection and the result is:
 #(2 nil nil)

Which show what doThis did.

in the workspace again type: 
(MyClass>>#doThis) inspect 

select and print it.
and you will get the inspector window on the complied
version of your method.

go back to the browser
mouse over the highlighted item in each column
from the option-click menu select 'fileout' for each
And look at your image's home directory to see what
you get.

Yours in service, -- Jerome Peace

>Another Dave dooright101 at yahoo.com 
>Thu Nov 30 05:32:12 UTC 2006 wrote:
>(nil asTraitComposition) print it returns a
MessageNotUnderstood dialog. 
>(Object>>#doesNotUnderstand:) print it returns a
System Window(3891), and a
>CompiledMethod dialog.
>I'm probably being too literal, or too dense? 

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.

More information about the Beginners mailing list