[squeak-dev] Block Equality (and startpc)

Levente Uzonyi leves at caesar.elte.hu
Sat Oct 5 08:59:27 UTC 2019


On Fri, 4 Oct 2019, Sean P. DeNigris wrote:

> Currently,
> BlockClosure >> #= aClosure
> 	self == aClosure ifTrue: [^true].
> 	aClosure class = self class ifFalse: [^false].
> 	(self method == aClosure method and: [startpc = aClosure startpc and: [self
> isClean]]) "<--- this line"
> 		ifTrue: [^true].
> 	^outerContext = aClosure outerContext and: [startpc = aClosure startpc]
>
> I wonder about `startpc = aClosure startpc` the first time it appears (in
> the comment-marked line). With it, in a workspace, the following is false:
> `[1] = [1]`, but removing that test makes it true. I'm not an expert on
> blocks, but doesn't `#isClean` preclude the need/desire for a startpc check
> in that statement?

But if you remove the comparison of startpcs, `[1] = [2]` will yield true 
as well. So, no, #isClean alone is not enough.
They way I see it, the startpc comparison lets us not to compare the 
contents of the block, but limiting #= to return true iff two activations 
of the same block are compared.

Levente

>
>
>
> -----
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Squeak-Dev-f45488.html


More information about the Squeak-dev mailing list