RE: RFC 67 (v1) Deep Copying, aka, cloning around.

2000-08-09 Thread Garrett Goebel
From: Peter Scott [mailto:[EMAIL PROTECTED]] I would like deep copying to include copying CODE. It would be useful for implementing object methods... Why would it be necessary to deep copy a CODE reference? It might not be necessary. I'm still learning how to write kosher Perl... elegance

RE: RFC 67 (v1) Deep Copying, aka, cloning around.

2000-08-08 Thread Garrett Goebel
Here's a version of my own kludgey deep copy. -Updated to use our mythical -CLONE method, and watch for circular references... our %SEEN = (); our $DEPTH = 0; %a = (a = 1, b = 2, c = [{a = 1, b = [1,2,3]}, 1, 2, 3]); *b = dcopy(\%a); sub dcopy { # Dereference and return a deep copy of

Re: RFC 67 (v1) Deep Copying, aka, cloning around.

2000-08-08 Thread Uri Guttman
"GG" == Garrett Goebel [EMAIL PROTECTED] writes: GG Oops, my circular ref code is/was screwy... and $SEEN{$_} = $rval or $SEEN = (); that last line looks screwy too! :-) assigning an empty list to a scalar? i think you meant to assign to %SEEN. but why reinvent the wheel with this

RE: RFC 67 (v1) Deep Copying, aka, cloning around.

2000-08-08 Thread Peter Scott
At 04:17 PM 8/8/00 -0500, Garrett Goebel wrote: Here's a version of my own kludgey deep copy. -Updated to use our mythical -CLONE method, and watch for circular references... Great stuff, I've put it in v2. [snip] : /^CODE$/ ? $_[0]# " (B::Deparse) [snip] I would like deep copying to

Re: RFC 67 (v1) Deep Copying, aka, cloning around.

2000-08-08 Thread Damian Conway
=head1 TITLE Deep Copying, aka, cloning around. The CCALLBACK is an optional function to be called if Cclone encounters a filehandle. ...or anything else it doesn't know how to handle. If Cclone encounters a tied variable, it will call the CCLONE method...

Re: RFC 67 (v1) Deep Copying, aka, cloning around.

2000-08-08 Thread Uri Guttman
wacko idea: combine a generic data tree traverse engine with damian's switch op. you pass this new smart traverse a ref and it will scan the tree. at every node it sees, it can call callbacks or methods. it can do the callbacks in pre, in or post ordering to get useful effects. if a node is an

Re: RFC 67 (v1) Deep Copying, aka, cloning around.

2000-08-08 Thread Peter Scott
At 06:10 PM 8/8/00 -0400, Uri Guttman wrote: wacko idea: combine a generic data tree traverse engine with damian's switch op. you pass this new smart traverse a ref and it will scan the tree. at every node it sees, it can call callbacks or methods. it can do the callbacks in pre, in or post