[GOODIE] Connectors pre-release version (for 3.2)

Ned Konz ned at bike-nomad.com
Mon Mar 25 18:55:06 UTC 2002


On Monday 25 March 2002 10:35 am, Henrik Gedenryd wrote:
> Rob Withers wrote:
> >>> I must have missed this problem. How does the events code relate to the
> >>> modules?! And what exactly is broken here?
> >>
> >> I think Henrik meant that Connectors was broken, not modules.
>
> Sorry if I was unclear.
>
> The code loads fine, but it no longer works correctly. I tried replacing
> trigger:with: with triggerEvent:with: but that wasn't enough at least when
> I tried it.

Were you trying the latest change set?

How did you get the object conversion preamble/postscript code to work?

I had to do this to migrate existing instances (since I renamed an instance 
variable and changed what it held):

* in the preamble, I added a new instance variable to the existing constraint 
morphs, if any, to change their shape (so the conversion method would be 
called). And I copied the contents of the former instance variable to the new 
one.

"Convert old instances if necessary."
(Smalltalk hasClassNamed: 'NCConstraintMorph') ifTrue: [
| i1 i2 |
i1 _ NCConstraintMorph allInstVarNames indexOf: 'targetBlock'.
i1 > 0 ifTrue: [
NCConstraintMorph addInstVarName: 'constraint'.
i2 _ NCConstraintMorph allInstVarNames indexOf: 'constraint'.
NCConstraintMorph allSubInstances do: [ :ea | ea instVarAt: i2 put: (ea 
instVarAt: i1) ].
]
]

* during loading, my conversion method was called:

convertToCurrentVersion: varDict refStream: smartRefStrm 
	"I renamed targetBlock to constraint to catch these conversions."

	varDict at: 'targetBlock'
		ifPresent:  [:b | constraint := b ].
	self convertToMessageSend.
	^super convertToCurrentVersion: varDict refStream: smartRefStrm

* afterwards (in the postscript), I ran another conversion method on my 
existing instances, and replaced the contents of another instance variable in 
instances of another class:

NCConstraintMorph allSubInstancesDo: [ :ea | ea convertToMessageSend ].
NCConnectorMorph allSubInstancesDo: [ :ea | ea reinitializeFSM ].


I'm not too clear on how to do this in the new Modules code...

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com



More information about the Squeak-dev mailing list