>> If you have copied the struct into another variable (inside your objects)
>> then the key will remain in the copies
sure the key will remain as a local copy but that also means it's no longer
pointing to the origional copy, yes?
so "<cfset objA = objB />" is just making "objA" as a reference to "objB" since
they're complex values?
the same holds for "<cfset _config = arguments.objConfig />", yes?
imagine some decorated objects ("controller" with a "service" and a "config")
stored in, say, application scope.
if I pass a reference to the "config" as an argument to the init of the
"service" - *and then* clear that config struct key from the "controller", have
I still got a reference to the origional from deep within the "service"?
thanx
barry.b
(code written from memory - excuse the errors)
<cfcomponent displayname="objController">
<cfset _config = structnew() />
<cfset _service = structnew() />
<cffunction name="init">
<cfset _config = createObject("component", config).init() />
<cfset _service.student = createObject("component",
student).init(objConfig="#_config#") />
<!--- so what happens if I delete the passed CFC reference here? --->
<cfset structDelete("variables", "_config") />
<!--- have I just passed in a reference to a (now) non-existant object
or forced a copy to be made in the service --->
<cfreturn this />
</cffunction>
... ... ... etc ... ... ...
<cfcomponent displayname="objStudent">
<cfset _config = structnew() />
<cffunction name="init">
<cfargument name="objConfig" type="struct" />
<cfset _config = arguments.objConfig />
<cfreturn this />
</cffunction>
...etc...
NOTE: why bother doing this? so I can call up to it within the services - like
this
<cfset dirRoot = _config.getRootPath() />
which means that if I run "_config.setRootPath(path)" elsewhere, the changes
should be picked up here in "the deep"
--
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]