logo       

RE: >> notation: msg#00189

lang.smalltalk.squeak.beginners

Subject: RE: >> notation

Dave

> You mention the browser, how would I use it to understand the
> MyClass>>doThis statement? Or is this even a good example for
> understanding
> ">>"?

MyClass>>doThis is not a statement of the Smalltalk language it is just
notation, a way to say (or write) the contents (or definition) of a method.

When you write:

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

It means that if you browse to the class MyClass, then to the method whose
selector is #doThis you will find:

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

Another example, if I include in a mail the following text:

String>>sameAs: aString
"Answer whether the receiver sorts equal to aString. The
collation sequence is ascii with case differences ignored."
^(self compare: aString caseSensitive: false) = 2

It means that I am (may be) asuming that the class String exists, that it
has a method whose selector is #sameAs: and it's definition is:

sameAs: aString
"Answer whether the receiver sorts equal to aString. The
collation sequence is ascii with case differences ignored."
^(self compare: aString caseSensitive: false) = 2

Try it, go and find the method sameAs: of the class String.

I hope this helps.

Emilio


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise