[Q] Newbie - Multiple Return Values

Stephane Ducasse ducasse at iam.unibe.ch
Thu May 1 20:43:26 UTC 2003


Hi

This is a really good advice. If you download the ESUG CD there are 
article of Erwing
Juanita and she presents exactly this solution to this problem.

Stef

> Just my 2 cents...
>
> It's rarely overkill to create new class, like NetworkRequestResult.
>
> It could contain a status and any accompanying messages.  As far as I 
> can
> tell, the only real overhead in creating another class, is the metal 
> energy to
> keep track of it...
>
> Delbert
>
> ---- Original message ----
>> Date: Thu, 01 May 2003 13:37:34 +0200
>> From: Ingo Hohmann <ingo at 2b1.de>
>> Subject: [Q] Newbie - Multiple Return Values
>> To: The general-purpose Squeak developers list <squeak-
> dev at lists.squeakfoundation.org>
>>
>> Hi to all again,
>>
>> for a network protocol I want to return to values from a function - 
>> the
>> payload of a message, and wether the message was tagged as being
>> successful or not.
>>
>> What would be the best way to return those values?
>>
>> - I thought about an instance variable for one of these, but there 
>> might
>> be multiple message pending.
>>
>> - Using Exceptions for the an unsuccessful message would be misusing 
>> the
>> exception mechanism.
>>
>> - And overloading the returnvalue - either an 'this was an error' 
>> value
>> _or_ the payload does not particularly please me either.
>>
>> - Creating a new Class for this on the other hand seems to be quite an
>> overkill.
>>
>> What's the best SmallTalk way to handle this?
>>
>>
>> Thanks,
>>
>> Ingo
>>
>>
>>
>
>
Prof. Dr. Stéphane DUCASSE
http://www.iam.unibe.ch/~ducasse/
  "if you knew today was your last day on earth, what would you do 
different? ...  especially if,
  by doing something different, today might not be your last day on 
earth" Calvin&Hobbes

"The best way to predict the future is to invent it..." Alan Kay.

Open Source Smalltalks: http://www.squeak.org, 
http://www.gnu.org/software/smalltalk/smalltalk.html
Free books for Universities at 
http://www.esug.org/sponsoring/promotionProgram.html
Free Online Book at 
http://www.iam.unibe.ch/~ducasse/WebPages/FreeBooks.html



More information about the Squeak-dev mailing list