I don't think you are understanding what we are saying here. You are NOT
deleting the original, but you are deleting your first REFERENCE to the
original object. In CF, there is no way to actually delete the structure
OBJECT, only references to it. It could be that, when you delete the
last reference to the object, CF deletes the object itself. Or maybe CF
doesn't and the garbage collector does it later. Anyway, when you delete
the last reference, you have no way of accessing the object anymore.

This is a code example that will maybe clarify this (creating a new one
instead of deleting)

<cfscript>
request.a = StructNew();
request.a.test = "Ingewikkelde structuur";
request.b = request.a;
</cfscript>
<cfdump var="#request#">
<cfset request.a.test = "Gewijzigde ingewikkelde structuur">
<cfdump var="#request#">
<cfscript>
request.a = StructNew(); // pointing the first reference to another
struct
request.a.othertest = "New structure, but b still exists";
</cfscript>
<cfdump var="#request#">

Pascal

> -----Original Message-----
> From: Taco Fleur [mailto:[EMAIL PROTECTED]
> Sent: 18 November 2004 10:16
> To: CF-Talk
> Subject: RE: Reference to complex var not destroyed
> 
> > I think it is you who is misunderstanding Dave.
> 
> Could be..
> But, what both of you are saying I thought I already understood, and I
> thought I explained that in my message?
> If you update the original, the reference gets updated, so when you
would
> delete the original you would think the reference gets deleted as
well, or
> would you not? How does that work in other languages?
> Or am I just not getting it?
> 
> Example:
> 
> <cfapplication name="test" sessionmanagement="Yes">
> <cfset application.test = structNew()>
> <cfset application.test.blabla = "ingewikkelde structure">
> <cfset server.test = application.test>
> <cfset structdelete(application, "test")>
> <cfdump var="#server#" /> I would think the test var in the server
scope
> would be gone too (or at least I hoped it would).
> <cfdump var="#application#" />
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:184710
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to