Saving morph books....

Bob Arning arning at charm.net
Thu Aug 19 23:53:01 UTC 1999


On Thu, 19 Aug 1999 17:09:41 -0500 "Mark Mayfield" <mmayfield at nuforia.com> wrote:
>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?

Mark,

Here's the short answer which may not do a lot to solve the problem, but which may keep you from going nuts looking at this.

MorphObjectOut is a proxy class, i.e. instances of it are used to represent instances of other Classes which may not be available (like they are on disk and not yet read in). To do this, it implements #doesNotUnderstand: and uses that as a cue to get the real object and become: that object. The problem is that #class is one of those few messages which are dispatched directly from bytecodes and not through normal method lookup routines (try overidding #class in some Class and see if it ever gets hit). So, while 99.999% of messages to an instance of MorphObjectOut get forwarded to, and answered by, the real object, #class gets answered by the VM on behalf of MorphObjectOut with unfortunate effects. I haven't looked into the intent of the code at work here, so I cannot give you a guaranteed solution at this time, but here is what I would try:

1. Implement in Object

realObjectClass

	^self class

2. Change the line in the method you referenced to read:

		(aUniClass := each realObjectClass) isSystemDefined ifFalse: [

and see if that works.

Cheers,
Bob





More information about the Squeak-dev mailing list