Yoshiki Ohshima wrote: > Charles, > > >> Todd Blanchard wrote: >> >>> The rule is, if you don't return a value, then self is returned. >>> There's no such thing as a void message like in C++ or Java. >>> >>> Tell me what you want to do and I'll see if I can scare up some examples. >>> >>> On May 8, 2006, at 10:16 PM, Charles D Hixson wrote: >>> >>> >>>> I know that in some languages this matters, and in others it doesn't. >>>> ... >>>> >>> ... >>> > > What Todd meant to say was: if you don't *explicitly* return a value > with a '^' statement, the receiver (self) is returned. Basically, all > message-sending return some values. > > >> Returning self is fine. I just wanted to know what would happen, so I >> could do things properly. >> (Actually, right not the methods would execute Object >> shouldBeImplemented, so they probably won't really return anything...but >> I was trying to plan for the future.) >> > > I don't know if the following is relevant what you do, but here is a > little fun fact. > > Almost all errors and explicit runtime exceptions like > #shouldNotImplemented are decorated break points. If you push the > "Proceed" button in the pink window called notifier, the execution > continues. Since Object>>shouldBeImplemented is implemented as: > --------- > shouldBeImplemented > "Announce that this message should be implemented" > > self error: 'This message should be implemented' > --------- > without any explicit return, the receiver is returned and the > execution continues. Try an expression like following, evaluate the > expression and "proceed". > > ---------- > Transcript show: (3 shouldBeImplemented + 4) printString. > ---------- > > -- Yoshiki Good. That is exactly the way I would want it to have been designed, now that I think about it.
_______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners