[Newbies] Should all methods return a value?

Todd Blanchard tblanchard at mac.com
Tue May 9 05:23:12 UTC 2006


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.
> E.g., in C if you return a value, the temporary must always be stored
> when the function is called, but in other languages it can be ignored,
> and in some languages if you don't intentionally return a value, the
> system will automatically create a value (usually nil) to return  
> for you.
>
> Eiffel make a big deal about separating Commands from Queries, with  
> very
> strict rules about which kinds of routines can do what kind of things.
>
> Presumably Squeak (and Smalltalk) is flexible here...but I haven't  
> seen
> it documented anywhere.  (Also, can anyone recommend a good tutorial
> that isn't graphics based?  What I want to do right now is really more
> text oriented.)  I got the two Mark Guzdial books, but that doesn't
> really cover much in any depth.
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners



More information about the Beginners mailing list