Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > about deep_clone
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 22nd April 02:55
john
External User
 
Posts: 1
Default about deep_clone


I'm not quite sure about deep_clone. if a chart of objects look like

A-->B-->C-->D-->..
and A-->B means A has reference/pointer to B

the assignment
O := deep_clone (C)

will generate a similar chart, as

a-->b-->c-->... and O = c ?

BTW, in Eiffel, how to see or print out all the generated
instances/references (this may be used to check deep_clone), like its
debugger will show the references while executing error occured.

--
Thanks
John
Toronto
  Reply With Quote


  sponsored links


2 22nd April 02:56
stevenwurster
External User
 
Posts: 1
Default about deep_clone


Well, I would think it would only generate the part of the chart from
'c' onward. That is, c-->d-->.., not the whole thing from 'a' on down.

Use the query 'tagged_out', present in ANY, and therefore all classes.
I think that's what the debugger uses when printing stack traces.
Note that this tends to be only one level deep, I believe. If you
want to go through all levels, you'll have to navigate them yourself
and call tagged_out from within each one of them.

Steve
  Reply With Quote
3 1st May 12:39
gregc
External User
 
Posts: 1
Default about deep_clone


Where the lowercase versions are copies? Yes, that is what should
happen. It's worth noting that for at least some compilers, deep_clone
is obsolete and you should call deep_twin instead.


Which compiler?

Greg C
  Reply With Quote
4 1st May 12:39
roger browne
External User
 
Posts: 1
Default about deep_clone


You should ALWAYS use the 'twin' features in preference to the 'clone'
features.

Recall that 'clone' is designed to be called unqualified, e.g.

class BAR -- (where BAR is not a descendant of FOO)
...
a, b: FOO
...
a := clone(b)

Suppose the author of class FOO had redefined 'clone' (because objects
of type FOO need some kind of special handling when cloned). The code
fragment above fails to call the redefined version of 'clone' (because
it is calling the version of 'clone' belonging to class BAR).

On the other hand, the author of FOO can redefine 'twin' and the
following code behaves as intended:

class BAR -- (where BAR is not a descendant of FOO)
...
a, b: FOO
...
a := b.twin

If you are using an old compiler that does not support the 'twin'
features, you can use this workaround:

class BAR -- (where BAR is not a descendant of FOO)
...
a, b: FOO
...
a := b.clone(b)

Regards,
Roger Browne
  Reply With Quote
5 1st May 12:39
john
External User
 
Posts: 1
Default about deep_clone


news:<_IQNb.1411$XZ.229489@news20.bellglobal.com>. ..

The Borland cc5.x, it doesn't support deep_twin

--
John
Toronto
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666