[squeak-dev] The Inbox: Kernel-cmm.814.mcz

Levente Uzonyi leves at elte.hu
Fri Oct 25 20:18:13 UTC 2013


I should have read it more carefully, because it's not the same. But I 
don't see the point of this method. Can you give me a good use case?


Levente

On Fri, 25 Oct 2013, Levente Uzonyi wrote:

> We already have two methods for this: #valueWithEnoughArguments: and 
> #valueWitPossibleArgs:. I think we should keep the first, and deprecate the 
> second.
>
>
> Levente
>
> On Fri, 25 Oct 2013, commits at source.squeak.org wrote:
>
>> A new version of Kernel was added to project The Inbox:
>> http://source.squeak.org/inbox/Kernel-cmm.814.mcz
>> 
>> ==================== Summary ====================
>> 
>> Name: Kernel-cmm.814
>> Author: cmm
>> Time: 25 October 2013, 2:27:37.722 pm
>> UUID: c757a2a8-26b1-422b-8b8b-4bf6640efbb4
>> Ancestors: Kernel-cmm.813
>> 
>> Added BlockClosure>>#valueWithAllPossibleArguments: to support passing a 
>> variable number of arguments to the image from the command-line.
>> 
>> =============== Diff against Kernel-cmm.813 ===============
>> 
>> Item was changed:
>> + ----- Method: BlockClosure>>valueOtherwise: (in category 'evaluating') 
>> -----
>> - ----- Method: BlockClosure>>valueOtherwise: (in category 
>> 'events-support') -----
>>  valueOtherwise: aBlock
>>  	"Send the message and answer the return value"
>>
>>  	^self value!
>> 
>> Item was added:
>> + ----- Method: BlockClosure>>valueWithAllPossibleArguments: (in category 
>> 'evaluating') -----
>> + valueWithAllPossibleArguments: anArray
>> + 	"Same as valueWithPossibleArgs: except when the receiver takes just 
>> one-argument, and more than one argument is specified by anArray, then pass 
>> all of anArray as THE argument to the receiver block
>> + 	This is used to allow a large, variable number of arguments to be 
>> passed."
>> + 	^numArgs = 0
>> + 		ifTrue: [self value]
>> + 		ifFalse:
>> + 			[self valueWithArguments:
>> + 				(numArgs = anArray size
>> + 					ifTrue: [anArray]
>> + 					ifFalse:
>> + 						[numArgs > anArray size
>> + 							ifTrue: [anArray, 
>> (Array new: numArgs - anArray size)]
>> + 							ifFalse:
>> + 								[numArgs = 1
>> + 
>> ifTrue: [Array with: anArray]
>> + 
>> ifFalse: [anArray copyFrom: 1 to: numArgs]]])]!
>> 
>> Item was changed:
>> + ----- Method: BlockClosure>>valueWithArguments:otherwise: (in category 
>> 'evaluating') -----
>> - ----- Method: BlockClosure>>valueWithArguments:otherwise: (in category 
>> 'events-support') -----
>>  valueWithArguments: anArray otherwise: aBlock
>>
>>  	^ self valueWithArguments: anArray!
>> 
>> Item was changed:
>> + ----- Method: BlockClosure>>valueWithEnoughArguments: (in category 
>> 'evaluating') -----
>> - ----- Method: BlockClosure>>valueWithEnoughArguments: (in category 
>> 'events-support') -----
>>  valueWithEnoughArguments: anArray
>>  	"call me with enough arguments from anArray"
>>  	| args |
>>  	(anArray size == self numArgs)
>>  		ifTrue: [ ^self valueWithArguments: anArray ].
>>
>>  	args := Array new: self numArgs.
>>  	args replaceFrom: 1
>>  		to: (anArray size min: args size)
>>  		with: anArray
>>  		startingAt: 1.
>>
>>  	^ self valueWithArguments: args!
>> 
>> 
>> 
>
>


More information about the Squeak-dev mailing list