[Vm-dev] An issue with Slang, the interpreter & the VM, and a period in biasToGrow.

Bert Freudenberg bert at freudenbergs.de
Tue Jan 23 10:36:16 UTC 2007


Am Jan 23, 2007 um 6:15  schrieb John M McIntosh:

> ObjectMemory>>biasToGrow
> 	| growSize |
> 	growSize :=  growHeadroom*3/2 - (self sizeOfFree: freeBlock)
> 	self growObjectMemory: growSize
>
> How clever, and if you've come this far, you've like seen the  
> missing period. at the end of
> 	"growSize :=  growHeadroom*3/2 - (self sizeOfFree: freeBlock)"
>
> Helpfully Slang doesn't complaint about the missing period and  
> forges onward creating in-valid C code, without the proper meaning.

Ugh. Evil slang.

So the fix would be that the receiver of a keyword message must be a  
variable in Slang, and if it is not, we should complain? Or, make it  
translate to the actual equivalent C code, calling growObjectMemory  
with two arguments, the first of which would be

	self(growHeadroom*3/2-sizeOfFree(freeBlock))

so this becomes

	growSize = growObjectMemory(self(growHeadroom*3/2-sizeOfFree 
(freeBlock)), growSize)

Hrmm. For C code that looks even sensible. I guess comnplaining is  
way safer.

> Hopefully people writing Slang code are muttering, gee I wonder if  
> I have some code that isn't quite what I think it is?

Nah, couldn't ever happen to me. Ever. Err. (... goes looking ...)

- Bert -





More information about the Squeak-dev mailing list