I don't quite understand some syntax seen in books

Bijan Parsia bparsia at email.unc.edu
Sun May 13 18:22:46 UTC 2001


--On Sunday, May 13, 2001 10:50 AM -0700 Ned Konz <ned at bike-nomad.com> 
wrote:

> On Sunday 13 May 2001 10:13, Thomas Porter wrote:
>
>> What the heck is the '>>' between 'Controller' and 'controlActivity'?
>>
>> Is this simply an indication that controlActivity is a method in class
>> Controller?
>
> yes

And, importantly, it's just a documentation trick. I.e., it's not part of 
any file-out format I know (though it's really easy to add it so that 
copying and pasting from books works).

(Er...assuming you're using e-books ;))

>> If so, what kind of method, class or instance?
>
> Instance. If it were class, it would be
>	 Controller class >> whatever

I've observed the following convention (to summarize):

	SomeClass>>someSelectorName
	SomeClass>>/
	SomeClass>>someSelectorName:withKeywords:

for "the method of SomeClass keyed by the symbol following the '>>'"

	SomeClass class>>someSelectorName

does the same for the class method, and

	#someSelectorName

to refer to the method in a context where the class was already 
established. So:
	"SomeClass>>someSelectorName is really a fine method. I use it all the 
time. So much so, that I wanted to add a method like #someSelectorName to 
SomeOtherClass. Here's the code for SomeOtherClass>>someSelectorName."

I suspect that the psuedo-symbol syntax can be a touch confusing, but it's 
really handy, especially when talking about class methods :)

Cheers,
Bijan Parsia.





More information about the Squeak-dev mailing list