[BUG] TestInterpreterPlugin

Andrew C. Greenberg werdna at gate.net
Thu Dec 9 14:33:30 UTC 1999


>primLargeIntegerSumB: x with: y
>	self
>		primitive: 'primLargeIntegerSumB'
>		parameters: #(SmallInteger SmallInteger )
>		receiver: #Oop.
>	^ x + y

This code, however pretty, will blow up big time!  The result of the 
return value will be coerced to an integer and returned to the VM. 
That integer will be treated as an oop.

The code generated from the return will give squeak an **oop 
pointer** equal to the sum of the two integers.  This is almost 
certainly not the intent of the programmer.  What you probably meant 
to do can be accomplished instead with:

primLargeIntegerSumB: x with: y
	self
		primitive: 'primLargeIntegerSumB'
		parameters: #(SmallInteger SmallInteger)
		receiver: #Oop.

	^ (x + y) asOop: SmallInteger

I strongly recommend scanning the documentation, such as it is, at:

	http://minnow.cc.gatech.edu/squeak/850





More information about the Squeak-dev mailing list