freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [pooma-dev] [Q] Field/Relations/RelationList.h:makeOwnCopy()


From: Richard Guenther
Subject: RE: [pooma-dev] [Q] Field/Relations/RelationList.h:makeOwnCopy()
Date: Wed, 29 Jan 2003 20:42:32 +0100 (CET)

On Wed, 29 Jan 2003, Richard Guenther wrote:

> Thinking more about it it seems you need the
> RelationList::makeOwnCopy(Target&) Target parameter only for the type of
> the current target (which is the only one expected to be passed) and use
> the retarget() machinery to clone the list item.
>
> The same goes with FieldEngine::makeOwnCopy() which needs to pass down
> the subject (of Field type)...

Actually this caused me thinking about Fields and Relations some more and
I believe the current code is as correct as it can be. I.e. both the
parameter to makeOwnCopy() and the retarget operation is actually
necessary. BUT - there is no way we can make this work in all cases,
consider:

  Field<...> a;
  Field<... View<..> > b(a);

  ... add some relations to a ...

  a.makeOwnCopy();

  ... now we're left with b having relations with still a as target :(

so strictly we need to add some asserts to FieldEngine::makeOwnCopy,
somethig like

  &s != any of the relation targets || no relations || fieldengine not shared

all in pseudocode, as these are not simple tests.

At least we ought to document that unsharing the target of relations leads
to undefined behavior.

Or am I wrong again?

Richard.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]