[Q] Newbie - Multiple Return Values

Stephane Ducasse ducasse at iam.unibe.ch
Sat May 3 18:46:11 UTC 2003


Hi dan

about something different but related. I thought a lot on a nice design 
for another smalltakish language to have unlimited (not sure about that 
term) number of parameters as in lisp dialect or default value to non 
specified arguments

(define foo (x . y)     or &rest
	...
(foo 1 2 3) -> y was then (2 3) if I remember

and
(define foo2 ( x (u 1))

(foo2 1) would bound u to 1

Have you ever played with the idea when designing one the ancestors of 
ST-80.

Stef



On Saturday, May 3, 2003, at 02:05 AM, Dan Ingalls wrote:

> Just in case anyone wants more about this, the topic ran the gamut 
> about three years ago on this list (about 15 messages on 1/18 and 1/19 
> of 2000.  It included Bert Freudenberg's nice presentation of multiple 
> argument blocks:
>
>> There is (at least) one other "strict" solution to this, which 
>> already is
>> utilized throughout the image - a multiple arg block:
>>
>> Something>>voltageCurrentTorqueIn: aBlock
>> 	| voltage current startingTorque |
>> 	voltage := ...
>> 	current := ...
>> 	startingTorque := ...
>> 	^aBlock valueWithArgumnts: {voltage. current. startingTorque}
>>
>> and the call would be
>>
>> 	something voltageCurrentTorqueIn:
>> 		[ :voltage :current :startingTorque |
>> 			do whatever with these values
>> 		]
>
> This is my favorite solution when there is no other reason for the 
> tuple, among other things because the block arguments provide 
> conveniently scoped and named variables.  There were a number of other 
> solutions proposed including self-constructing tuple classes and  
> in-line dictionaries.
>
> I think it got discussed about three years before that too...  ;-).
>
> 	- Dan
>
>
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