Ah.  I see.  You're totally right.  That doesn't make sense.   Serves me right for firing off a quick response...  :-(

The following code returns "YES" so I wonder if it's because the structkeyexists() from Sammy's code  involves the URL scope? 

<cfset s = structNew()>
<cfset s.test = 1>
<cfset tempS = structcopy(s)>
<cfset structdelete(tempS, "test")>
<cfoutput>
   #structkeyexists(s,"test")#
</cfoutput>

My bad.  Sorry, Sammy.

Jon

On Oct 26, 2006, at 8:39 PM, Jim Flannery wrote:

JC> structCopy: Copies a structure. Copies top-level keys, values, and

JC> arrays in the structure by value; copies nested structures by

JC> reference.


JC> Looks like the structCopy() is doing what it's supposed to do to me

JC> since the url.test isn't nested and is a simple value.


Why then would deleting the copy of the top-level key which is a simple

value delete the original of the key (expected behavior if it were

copied *by reference*)?


(n.b. Sammy, if this is a problem you likely want to be using

Duplicate(), which was introduced to work around exactly this

Jekyll/Hyde behavior.)



You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to