[Pkg] The Trunk: Kernel-cmm.814.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Oct 25 20:08:48 UTC 2013


Chris Muller uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/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 Packages mailing list