![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
MP1 DiscussionHenry Woo Question 1.6 -I don't understand how the Smalltalk evaluate the following: 3 + 1 raisedTo: 3; "without the semicolon, it is 64" raisedTo: 2 "with the previous semicolon, it is 16" Is it because the receiver is (3 + 1) ? Thanks. Shayne Czyzewski - I believe this is because the ';' signifies a cascade, which means you simply ignore the returned result of the previous expression (64), and send the next message to the same receiver of the previous message. So it has the effect of evaluating 4 raised to 3, discarding the result of 64, then evaluating 4 raised to 2. This is how I view it anyway. Hope it helped. Nicholas Chen - Shayne's explanation is right. You can also refer to Maurice Rabb's explanation on cascades from last semester. Question 2.6.3 - What are the methods in the Date's protocol 'squeak protocol'? Which protocol class protocol or instance protocol. I'm assuming instance as there are a lot of class protocols. Nicholas Chen - I accepted answers that listed both class and instance methods for that category and also answers that only list instance methods for that category. Link to this Page
|