[BUG] [Q] ReferenceStream>>beginReference:

Diego Gomez Deck DiegoGomezDeck at ConsultAr.com
Mon Mar 18 07:42:56 UTC 2002


beginReference: anObject
	"Remember anObject as the object we read at the position recorded by
	noteCurrentReference:. This must be done after instantiating anObject
	but before reading any of its contents that might (directly or
	indirectly) refer to
	it. (It's ok to do this redundantly, which is convenient for #next.)
	Answer the reference position."
	objects
		at: currentReference
		ifAbsent: [objects at: currentReference put: anObject.
			^ currentReference"position relative to start of data portion of file"].
	(skipping includes: currentReference)
		ifFalse: ["If reading just to skip it, don't record this copy."
			objects at: currentReference put: anObject].
	^ currentReference

The second #at:put: sent to objects is not necessary, because this code get 
executed only when the anObject already exists in the IdentitySet.

The question is: The checking for skipping must be done inside the ifAbsent 
block?

Cheers,

Diego Gomez Deck




More information about the Squeak-dev mailing list