Error in BlockContext>>valueWithArguments:

Dave Mason dmason at sarg.ryerson.ca
Sat Apr 15 22:22:54 UTC 2006


This in Squeak3.8-6665.  

BlockContext>>valueWithArguments gives a very misleading error.
Basically the 'already being evaluated' case is the fallback, but if you
have a non-array anArray parameter, the primitive fails and you get that
fallback error.  I just added a test for that case.

(I was playing with continuations, so 'already being evaluated' *was* a
possibility, which made it extra-challenging to track down.)

../Dave


valueWithArguments: anArray 
	"Primitive. Evaluate the block represented by the receiver. The argument 
	is an Array whose elements are the arguments for the block. Fail if the 
	length of the Array is not the same as the the number of arguments that 
	the block was expecting. Fail if the block is already being executed. 
	Essential. See Object documentation whatIsAPrimitive."

	<primitive: 82>

	self numArgs = anArray size
		ifTrue: [(anArray isKindOf: Array)
				ifTrue:[self error: 'Attempt to evaluate a block that is already being evaluated.']
				ifFalse:[self error: 'parameter is not an Array']]
		ifFalse: [self error: 
			'This block accepts ' ,self numArgs printString, ' argument', (self numArgs = 1 ifTrue:[''] ifFalse:['s']) , 
			', but was called with ', anArray size printString, '.']




More information about the Squeak-dev mailing list