Be aware that there is a similar issue in Duplicate. If you duplicate a
structure that has an array that has an element that is a struct, you will
get a pointer. To see this, run this code:

<CFSET A = StructNew()>
<CFSET A.Arr = ArrayNew(1)>
<CFSET A.Arr[1] = "Simple">
<CFSET A.Arr[2] = StructNew()>

<CFSET B = Duplicate(A)>
<CFSET B.Arr[1] = "Not simple">
<CFOUTPUT>
The simple value is NOT a pointer, #A.Arr[1]#
<P>
</CFOUTPUT>

<CFSET B.Arr[2].Foo = "Jedi">
<CFOUTPUT>
B.Arr[2].Foo is a pointer. Here is the proof:
#A.Arr[2].Foo#
</CFOUTPUT>

=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Allaire

Email   : [EMAIL PROTECTED]
ICQ UIN : 3679482

"My ally is the Force, and a powerful ally it is." - Yoda

> -----Original Message-----
> From: Steve Martin [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 21, 2000 5:43 AM
> To: CF-Talk
> Subject: RE: Duplicate supported in CF4.0
>
>
> Not entirely true. Structcopy does actually duplicate the structure in
> question. I think there's some confusion here over <cfset
> somenewvar=anoldstruct> which creates a pointer to the original.
> Structcopy
> however only performs a shallow copy in that any embedded
> structures within
> the structure that you are trying to duplicate aren't copied wholesale but
> are referenced through pointers.
>
> Steve
>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to