For me, it was academic. When some one has a tough problem that I can't see immediately how to find an answer to, I like to find an answer. That compulsion gets stronger as the number of "this can't be done" replies increase. =) I can't answer for Ed as to what his need is, however. But I can say that the use Per and I were discussing was trying to evaluate dynamically what a function should do based on its name.
-Sam

Teddy Payne wrote, On 12/8/2006 11:35 AM:
Now, this looks academic. What would be the use of knowing the name of variable that stores the memory location of the object's invocation? Teddy On 12/8/06, *Sammy Larbi* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Actually, this is quite a bit easier that I thought.   This function
    will output the names of all the variables (I think) that
    reference your
    component, given a scope.  I got the idea for inserting a UUID from
    looking at cfcUnit, so I gotta give credit there.  Of course, it will
    need to be in your component.

    <cffunction name="getTheNameOfTheVariableThatContainsMe"
    output="true">
           <cfargument name="variablesScope" required="true">
           <cfset this.testkey = createUUID()>
           <cfloop list="#structkeylist(variablesScope)#" index="name">
               <cfif isStruct(variablesScope[name]) and
    structKeyExists(variablesScope[name],"testKey") and
    variablesScope[name].testKey eq this.testKey>
                   #name#,
               </cfif>
           </cfloop>
           <cfset structDelete(this,"testKey")>
       </cffunction>






    Ed Griffiths wrote, On 12/8/2006 8:40 AM:
    > Hi
    >
    > Quick question. If you store an object in a variable like this:
    >
    > <cfset myObject = createObject("component","testObject").init()>
    >
    > Is it possible to interrogate some method or metadata associated
    with
    > testObject in order to find out what variable name it has been
    stored within
    > (myObject in this case)?
    >
    > Thanks for your help,
    > Ed
    >
    >
    >
    >
    > 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 <http://www.katapultmedia.com>
    >
    > An archive of the CFCDev list is available at
    www.mail-archive.com/[email protected]
    <http://www.mail-archive.com/[email protected]>
    >
    >
    >
    >



    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 <http://www.katapultmedia.com>

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




--
<cf_payne />
Adobe Certified ColdFusion MX 7 Developer
Atlanta CFUG (ACFUG): http://www.acfug.org
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]



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