Quantcast

p.74

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

p.74

blake watson
"Note that the object receiving the cascaded messages can itself be the result of a message send. In fact the receiver of all the cascaded messages is the receiver of the first message involved in a cascade. In the following example, the first cascaded message is setX:setY since it is followed by a cascade. The receiver of the cascaded message setX:setY: is the newly created point resulting from the evaluation of Point new, and not Point. The subsequent message isZero is sent to that same receiver.

Point new setX: 25 setY: 35; isZero−→false"

Is not the first message in this cascade "new" and is it not "Point" that receives it?

_______________________________________________
Sbe-discussion mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: p.74

Oscar Nierstrasz

Hi Blake,

Read it again. You will see that the Point instance, not the class, receives the isZero message. Ergo, new is not the first msg of the cascade.

Cheers,
Oscar

---
Prof. Dr. O. Nierstrasz    -- [hidden email]
Software Composition Group -- http://scg.unibe.ch/oscar
University of Bern         -- Tel/Fax +41 31 631.4618/3355


On 2013-09-19, at 1:50, blake <[hidden email]> wrote:

> "Note that the object receiving the cascaded messages can itself be the result of a message send. In fact the receiver of all the cascaded messages is the receiver of the first message involved in a cascade. In the following example, the first cascaded message is setX:setY since it is followed by a cascade. The receiver of the cascaded message setX:setY: is the newly created point resulting from the evaluation of Point new, and not Point. The subsequent message isZero is sent to that same receiver.
>
> Point new setX: 25 setY: 35; isZero−→false"
>
> Is not the first message in this cascade "new" and is it not "Point" that receives it?
> _______________________________________________
> Sbe-discussion mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion

_______________________________________________
Sbe-discussion mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: p.74

blake watson
Right, I'm sorry--I wasn't being clear. I would probably format that code differently, at least for illustrative purposes. Or at least put in some clarifying text. If it were:

Point new; setX: 25 setY: 35; isZero 

You get an error because Point class doesn't have setX, etc. The difference is a mere semi-colon, easy to miss:

Point new setX: 25 setY: 35; isZero 

So you might format it:

Point new
        setX:25 setY: 25;
        isZero

===Blake===



On Wed, Sep 18, 2013 at 11:27 PM, Oscar Nierstrasz <[hidden email]> wrote:

Hi Blake,

Read it again. You will see that the Point instance, not the class, receives the isZero message. Ergo, new is not the first msg of the cascade.

Cheers,
Oscar

---
Prof. Dr. O. Nierstrasz    -- [hidden email]
Software Composition Group -- http://scg.unibe.ch/oscar
University of Bern         -- Tel/Fax +41 31 631.4618/3355


On 2013-09-19, at 1:50, blake <[hidden email]> wrote:

> "Note that the object receiving the cascaded messages can itself be the result of a message send. In fact the receiver of all the cascaded messages is the receiver of the first message involved in a cascade. In the following example, the first cascaded message is setX:setY since it is followed by a cascade. The receiver of the cascaded message setX:setY: is the newly created point resulting from the evaluation of Point new, and not Point. The subsequent message isZero is sent to that same receiver.
>
> Point new setX: 25 setY: 35; isZero−→false"
>
> Is not the first message in this cascade "new" and is it not "Point" that receives it?
> _______________________________________________
> Sbe-discussion mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion

_______________________________________________
Sbe-discussion mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion


_______________________________________________
Sbe-discussion mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: p.74

Oscar Nierstrasz

Right, good suggestion!

(I almost wrote "good point".)

Oscar



On 2013-09-19, at 18:23, blake <[hidden email]> wrote:

Right, I'm sorry--I wasn't being clear. I would probably format that code differently, at least for illustrative purposes. Or at least put in some clarifying text. If it were:

Point new; setX: 25 setY: 35; isZero 

You get an error because Point class doesn't have setX, etc. The difference is a mere semi-colon, easy to miss:

Point new setX: 25 setY: 35; isZero 

So you might format it:

Point new
        setX:25 setY: 25;
        isZero

===Blake===



On Wed, Sep 18, 2013 at 11:27 PM, Oscar Nierstrasz <[hidden email]> wrote:

Hi Blake,

Read it again. You will see that the Point instance, not the class, receives the isZero message. Ergo, new is not the first msg of the cascade.

Cheers,
Oscar

---
Prof. Dr. O. Nierstrasz    -- [hidden email]
Software Composition Group -- http://scg.unibe.ch/oscar
University of Bern         -- Tel/Fax +41 31 631.4618/3355


On 2013-09-19, at 1:50, blake <[hidden email]> wrote:

> "Note that the object receiving the cascaded messages can itself be the result of a message send. In fact the receiver of all the cascaded messages is the receiver of the first message involved in a cascade. In the following example, the first cascaded message is setX:setY since it is followed by a cascade. The receiver of the cascaded message setX:setY: is the newly created point resulting from the evaluation of Point new, and not Point. The subsequent message isZero is sent to that same receiver.
>
> Point new setX: 25 setY: 35; isZero−→false"
>
> Is not the first message in this cascade "new" and is it not "Point" that receives it?
> _______________________________________________
> Sbe-discussion mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion

_______________________________________________
Sbe-discussion mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion

_______________________________________________
Sbe-discussion mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion

_______________________________________________
Sbe-discussion mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion
Loading...