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

David T. Lewis lewis at mail.msen.com
Tue Jan 23 10:59:48 UTC 2007

On Tue, Jan 23, 2007 at 11:36:16AM +0100, Bert Freudenberg wrote:
> 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.

Um, wait a minute. The Smalltalk compiler does not complain about it,
so why would we expect the Slang translator to complain about it? It's
perfectly valid Smalltalk, and it does not blow up until you run it
in Squeak.

Wasn't being able to write and test the code in Squeak sort of the
whole point of Slang in the first place?

> 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.

Another thing that might help is to have some simple way to show
generated C code for a method, perhaps right in a browser.


More information about the Vm-dev mailing list