Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: Copy of an anonymous hash?

by salva (Abbot)
on Apr 26, 2005 at 12:18 UTC ( #451521=note: print w/replies, xml ) Need Help??

in reply to Re: Copy of an anonymous hash?
in thread Copy of an anonymous hash?

deep copy is not always the solution:

There is shallow copy in one extreme and deep copy in the other an in the middle lots of intermediate solutions, which one is the good one depends on the particular data representation.

For instance, if you are cloning an object representing an XML node, you will like to deep-copy all its children but not the pointer to its parent.

Replies are listed 'Best First'.
Re^3: Copy of an anonymous hash?
by pelagic (Priest) on Apr 26, 2005 at 12:29 UTC
    100% agreed!
    I didn't say deep copy is the solution, I said it's the topic ;)

Re^3: Copy of an anonymous hash?
by ambrus (Abbot) on Apr 26, 2005 at 19:47 UTC

    Shallow copy is usually a good solution: all you need is to do a shallow copy whenever you change a structure.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://451521]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2017-08-20 06:37 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (313 votes). Check out past polls.