I'm not clear on why you would want to copy the instance instead of create a
reference to it.

That said, you could serialize the original and then deserialize the
serialized version to make a true clone of the object (this requires using
Java though). You could even wrap up this logic into a cloneComponent()
method and attach it to the component that you want to copy, if you really
wanted to. The benefit (or drawback) here is that the clone would also
maintain copies of any composed components that the original had. So not
only would you lose any references that other objects had to the original
instance, you'd also lose any references that the original instance had to
other objects.

In any event, unless you have some fundamental reason to want a copy, just
use a reference.

On 10/29/07, Ryan Heldt <[EMAIL PROTECTED]> wrote:
>
> Greetings all-
>
> I realize this topic may have been covered on this list a while back, but
> I'm having problems locating a good answer, so here goes. Typically in our
> administrative web sites, on a request, we copy over our session variables
> to the request scope so we can have read-access to the information without
> having to place locks all over the place. Now that we're doing more OO
> stuff, I would like the ability to persist an object in the session scope
> while a user is signed in, and then copy it over to request for the same
> purpose. As you know, <cfset session.object = request.object /> only
> creates
> a pointer to original, and duplicate() doesn't work on CFCs (we're using
> CFMX 7). Anyone have a workaround or best-practice solution for this type
> of
> thing?
>
>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292256
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to