[Newbies] >> notation

Another Dave dooright101 at yahoo.com
Thu Nov 30 16:57:45 UTC 2006



Stuart Herring wrote:
> 
> 
> The ">>" is just a way of indicating that you're talking about a message
> name.
> 
> In your example, MyClass is the class name, and doThis is the message
> name.  You'll never actually enter the ">>" when defining a message,
> instead you'd put the code in the doThis message of MyClass in the
> browser.
> 
> Regards,
> Stuart.
> 
> 

Thanks, Stuart for your reply. I should understand by now. There must be
something very simple I am missing, because the ">>" symbol is used almost
in passing in the early chapters of many tutorials.

In the example:

MyClass>>doThis
 array := Array new: 3.
 array at: 1 put: 2. 

you say that MyClass is the class name, and doThis is the message name. I
follow so far, even though with the object/message syntax of Smalltalk I
would expect the arrows to point the other direction. I have learned that we
don't use classes directly, we use instances of classes. So we couldn't use
the first line of the above example without doing first:

foo := MyClass

so that we could pass whatever message doThis might be. Right? Is doThis
predefined, or is it somehow being defined in this example?

Further, I am confused that the ">>" is not a symbol that is input to the
machine, but rather a symbol that is output to indicate some relationship or
function (you say message name indicator), yet MyClass>>doThis is clearly
not merely a comment.

Last, I do not understand how the MyClass>>doThis of the above example
relates in any way to the second and third lines.






-- 
View this message in context: http://www.nabble.com/%3E%3E-notation-tf2729086.html#a7623186
Sent from the Squeak - Beginners mailing list archive at Nabble.com.



More information about the Beginners mailing list