On 04.10.2011, at 19:16, Erlis Vidal wrote:

> Thanks Bert!
> 
> The byte code has the answer, I thought that the byte code will map the 
> source code but I see that's not the case, probably to ensure some 
> optimizations.. or to do that "jump" I don't know how to do that in smalltalk

For ifTrue: it is purely an optimization, yes. It would work fine by actually 
sending that message. It would just be slower.

In the case of whileTrue:, however, it's not just an optimization. The only way 
to do loops otherwise would be by recursion. But the Squeak VM does not do 
tail-call elimination, so it would run out of space pretty soon. Generating the 
loop as a byte code back jump is essential for the system to work.

- Bert -


_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to