[REBOL] Re: copy with object words and values
From: greggirwin:starband at: 13-Sep-2001 17:05
Hi Ryan,
<< When writing
function "libraries", often it is good to return the original, so as the
programmer can decide whether a copy is warranted. On the other hand, the
above
code represents an instance where you want to use 'copy, reminiscent of
copying
the contents section from a book and excluding the first heading. >>
Good point. I hadn't thought about the callers ability to move back to
someplace
you maybe don't want them to (e.g. back values-of object). OTOH, you can do
back copy values-of object
and be OK, so the caller is in control. Hmmm.
I'm
not worried so much about large objects but multiple hits on small objects.
<< First you have defined 'Copy to mean something else in the body of your
function. No problem though, it just has to be account for by refering to
the
definition of copy in system/words. >>
ACK! Obviously I hadn't tried this code yet.<g> Man, I love the flexibility
that
REBOL gives me but I'm sure I'll be shooting myself in the foot quite a lot
as I work with it. Thanks for catching that.
<< You probably wont like the "inline" version as much, but here it is:
do either copy [get in system/words 'copy][none] next second object >>
Yeah, that's kind of ugly.<g>
Thanks!
--Gregg