| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Finally, you can manage your Google Docs, uploads, and email attachments (plus Dropbox and Slack files) in one convenient place. Claim a free account, and in less than 2 minutes, Dokkio (from the makers of PBworks) can automatically organize your content for you.

View
 

Shorthand for methods

Page history last edited by PBworks 14 years, 1 month ago

> I'm having trouble understanding the '>>' in some Smalltalk programs, Such

> as this, from Smalltalk By Example:

>

> MyClass>>doThis

> array := Array new: 3.

> array at: 1 put: 2.

>

> I can understand that we are creating a new 3-place instance of Array, named

> array, and putting 2 in the first slot. But I don't understand what MyClass,

> >>, or doThis are doing.

 

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.


You will also sometimes see something like:

 

Person class >> new

 

When someone is writing about code. This means that you should look on the

class side of Person for the method #new. People will also indicate the

method name with a symbol (for example #new) if they are writing the method

name in-lined in a sentence.

Comments (0)

You don't have permission to comment on this page.