Saving morph books....

Mark Mayfield mmayfield at nuforia.com
Thu Aug 19 22:09:41 UTC 1999


When saving a morph book to a file in version 2.5 I get an error in 
the following method...

uniClassInstVarsRefs: dummy
	"If some of the objects seen so far are instances UniClasses, 
check the UniClasses for extra class inst vars, and send them to the 
steam also.  The new objects get added to (dummy references), where 
they will be noticed by the caller.  They will wind up in the 
structures array and will be written on the disk by class."

| uniClasses normal more aUniClass mySize |
"Any classes used in the structure of classInstVars must be written out also!
	dummy nextPut: (OrderedCollection new).
But for now, only uses Arrays."

uniClasses := Set new.
normal := Object class instSize.
more := true.
[more] whileTrue: [
	more := false.
	dummy references keysDo: [:each | "any faster way to do this?"
		(aUniClass := each class) isSystemDefined ifFalse: [
			(uniClasses includes: aUniClass name) ifFalse: [
				mySize := aUniClass class instSize.
				normal+1 to: mySize do: [:ii |
					more := true.
					dummy nextPut: (aUniClass 
instVarAt: ii)].
				uniClasses add: aUniClass name]]]].
"References dictionary is modified as the loop proceeds, but we will 
catch any we missed on the next cycle."

The error occurs in the following line:

			(aUniClass := each class) isSystemDefined ifFalse: [

When I inspect the objects within the debugger, each is a 
PasteUpMorph object, BUT aUniClass is a MorphObjectOut. When a 
MorphObjectOut is sent the message isSystemDefine, I get the error. 
Why wouldn't the assignment aUniClass := each class not assign 
aUniClass the class of the object referenced by each?

Thanks,

Mark





More information about the Squeak-dev mailing list