[Help] How do you work deep copier?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Help] How do you work deep copier?

Jerome Peace
Hi all,

I could use some advice on the how deep copier does its work and how to use it to achieve a particular result.

Use case described below.



context:
I want to write some event handling s.t.
1) I can avoid the usual click,dblclick,drag handler (it has deep bugs)
2) I can distinguish behaviors on mouse up between clickup and dragup.
3) I can implement some fairly fancy mousemove drag handling.

4) Hopefully for any morph.

Now I have achieved 1 thru 4 up to the point that I use the mouse halos to make a copy of the morph. Then it breaks down.

The success was to create an event listener (and travel agent) using the
morphs #on:sendTo: mechanism to send the morphs events to this travel agent.

The agent keeps track of the origin and destination of the morph on each leg of its journey. It also holds on to the movement model for the morph.
Each morph needs its own agent so that the origin and destination state apply to it alone.

problem: When the halos duplicates the morph they give the new morph the same agent as the old morph.
The result is that changing destinations for one or the other affects the behavior of both adversely.

analysis so far: the halo dup handle sends the #duplicate message to the morph. Which in turn sends deep copy. I tried looking into it further but deep copy is a horror. Knowing so many special cases it has grown a page long. I gave up for the moment.

The agent object is pointed to in several places in the event handlers ivars. So it needs to be changed into the same something else in about three places.

Question: Is there some message that the agent will be sent during the deep copy process. And if so how should it handle that message to produce the desired result?

Yours in curiosity and service, --Jerome Peace


     

Reply | Threaded
Open this post in threaded view
|

Re: [Help] How do you work deep copier?

Stéphane Rollandin

> I tried looking into it further but deep copy is a horror.

#veryDeepInner: and #veryDeepFixupWith: are the key methods driving the
fine behavior of a very deep copy (what is shared, deep copied or very
deep copied)

There are many implementors of those. By studying them you should see
how the copy mechanism work. You can then decide how to copy or share
the inst vars you wants.


Stef