[Newbies] Simple Precedence question
Randal L. Schwartz
merlyn at stonehenge.com
Wed Feb 13 02:26:25 UTC 2008
>>>>> "Jeffrey" == Jeffrey Straszheim <jstraszheim at comcast.net> writes:
Jeffrey> So, I'm learning Smalltalk for the first time, and I have a very
Jeffrey> simple question regarding the precedence of the cascade operator.
Jeffrey> So, in this expression:
Jeffrey> self something: anObject selector ; anotherSelector.
Jeffrey> Is the target of *anotherSelector* anObject, or self?
The way to read ";" is that you're replacing the last message
send of what precedes it with what follows it. So let's see
the order there:
t1 := anObject selector.
t2 := self something: t1.
That should make sense. Now for the cascade... we do another
message send to whatever the most recent *receiver* was. In this
t3 := self anotherSelector.
And the overall value would be t3, if anyone looked at it.
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
More information about the Beginners