Gotcha.  In this particular case I was using duplicate() to copy a 
request-scope query that was being manipulated by a custom tag that 
recursively returns every file in a directory and subdirectories (used 
request scope so the result set was available to each tag 
invocation).  When I'm done I do this:

    <cfset "caller.#request.r_query#" = duplicate(request.q_all_files)>

.. . . to "return" the final query to the calling template.

I thought duplicate() would be the correct way to do this, especially in 
light of Andy's post that a straight assignment really behaves like a 
pointer, while duplicate makes an actual copy.  In my case a pointer works 
because I'm using request-scope inside the custom tag, so it doesn't vanish 
when the tag is through executing, but I have a coworker who was 
experiencing the same problem, and her tag creates a query local to the tag 
and then returns it.  Here, I'd think duplicate() would be mandatory.  But 
it's not - the straight assignment (pointer?) works even though it seems 
like the original query (created in the custom tag) should die when the tag 
finishes.  But it doesn't.  Perhaps CF doesn't clean up tags until the 
request is finished?  Or perhaps it won't delete an object that still has 
outstanding pointers?  Dunno.  Anyway, just rambling now, I guess.

Thanks!

Jim

At 08:30 AM 3/13/01 -0700, Emily B. Kim wrote:
>quick thought: i'm not positive about this, but i don't think you really
>need the duplicate() function for the request scope if you're just
>assigning it's value to another variable. the request scope only lasts for
>the page request, so it's going to expire anyway. i think that the
>duplicate() function is most useful for scopes that persist (like
>application, server, session) when you're trying to fully copy them from
>their scopes. -emily
>
> >     [1] Is using duplicate() on queries always a bad idea, or just when you
> >are copying them back to caller scope?  (I think I've "duplicated" queries
> >in app.cfm to app scope without incident, but I'm doubting my memory based
> >on this experience.)
> >
> >     [2] I was surprised that a straight assignment worked.  Can anyone tell
> >me when I should use straight assignment vs. duplicate()?
> >
> >     [3] I saw a post in Forums that I have to pay $75 to make a bug
> >report.  Is this true?
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
------------------------------------------------------------------------------
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/spectra_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to