[squeak-dev] The Trunk: System-cwp.660.mcz

Colin Putney colin at wiresong.com
Thu Jan 9 14:06:17 UTC 2014


On Thu, Jan 9, 2014 at 2:01 AM, Levente Uzonyi <leves at elte.hu> wrote:


> Btw, this won't work, because this expression is evaluated as
>
>         ((lastObject == object) | object) == 0
>
> which should raise an error, because most objects don't understand #|.
> Also, I prefer the lazy #or: over #|, because it's faster.


You're right, it's a bug, but it does work, accidentally. It ends up going
like this:

1. lastObject == object -> aBoolean
2. aBoolean | object -> true or object
3a. true == 0 -> false
3b. object == 0 -> true or false

For all objects except the sentinel object, we end up at 3b, and since
#nextObject answers 0 when the receiver is the last object in the heap, we
end up with the correct semantics.

However, it defeats the purpose of the sentinel object, which is to avoid
an infinite loop caused by new block contexts being allocated when the
block is executed. The reason I needed this change in the first place is
that I was getting an error because SmallInteger shouldn't implement
#nextObject. So somehow we were getting to the end of the heap without
encountering the sentinel.

So I have two questions:

1) Why isn't the sentinel object enumerated in a shrunken image?
2) Why don't we get an infinite loop when we don't check for the sentinel?

Colin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140109/fcd71893/attachment.htm


More information about the Squeak-dev mailing list