[squeak-dev] use of pointsTo: for includesSelector:

David T. Lewis lewis at mail.msen.com
Fri Oct 25 22:40:54 UTC 2013


On Fri, Oct 25, 2013 at 02:18:07PM -0700, Eliot Miranda wrote:
> 
> ProtoObject>>pointsTo: anObject
> "This method returns true if self contains a pointer to anObject,
> and returns false otherwise"
> <primitive: 132>
> 1 to: self class instSize do:
> [:i | (self instVarAt: i) == anObject ifTrue: [^ true]].
> 1 to: self basicSize do:
> [:i | (self basicAt: i) == anObject ifTrue: [^ true]].
> ^ false

The version of ProtoObject>>pointsTo: that you quote here has a time stamp
from 1999. The current version in Squeak has a time stamp of 2008, and
looks like this:


ProtoObject>>pointsTo: anObject
"Answers true if I hold a reference to anObject, or false otherwise. Or stated another way:

Answers true if the garbage collector would fail to collect anObject because I hold a reference to it, or false otherwise"

	^ (self instVarsInclude: anObject)
		or: [self class == anObject]




More information about the Squeak-dev mailing list