[Newbies] >> notation
Emilio Oca
eoca at afip.gov.ar
Thu Nov 30 18:16:06 UTC 2006
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
More information about the Beginners
mailing list