When you call an un-scoped "abc", CF is going to check the local "variables"
scope first, then run down the rest of the scopes until it finds a variable
named "abc", which in the function test, happens to be an "arguments"
variable.  

Same thing goes for you when you set "abc" without a scope, it is going to
automatically set the value into the "variables" scope, which is definitely
different from the arguments scope...(that is, unless I'm reading all of
this wrong)

So "abc" and "arguments.abc" are not the same thing.  When you call "abc" by
itself, you are really calling "variables.abc", then if it doesn't exists,
it will check for "url.abc", "form.abc", "arguments.abc", etc (not
necessarily in that order-I do not know where arguments fits in the order of
evaluation)->

Tyler

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Brad Howerter
Sent: Tuesday, September 09, 2003 1:32 PM
To: '[EMAIL PROTECTED]'
Subject: [CFCDev] Unexpected CFC behaviour, please explain!

If you call the test method in this component, why does abc show the
original value that is passed in, even after it has been reset with the
cfset?  For example, if you call it like obj.test('foo'), the first cfoutput
displays abc=foo, arguments.abc=foo, and then the second output displays
abc=foo, arguments.abc=123.  Shouldn't abc=123?
Similarly, if you run test2, only abc is displayed as 123, arguments.abc
still shows 'foo'.  I thought abc and arguments.abc should be the same
thing, but apparently they're not.
<cfcomponent>
        <cffunction name="test">
                <cfargument name="abc" type="string">
                <cfoutput>abc = #abc#, arguments.abc =
#arguments.abc#<br></cfoutput>
                <cfset arguments.abc = '123'>
                <cfoutput>abc = #abc#, arguments.abc =
#arguments.abc#</cfoutput>
        </cffunction>
        <cffunction name="test2">
                <cfargument name="abc" type="string" default="foo">
                <cfoutput>abc = #abc#, arguments.abc =
#arguments.abc#<br></cfoutput>
                <cfset abc = '123'>
                <cfoutput>abc = #abc#, arguments.abc =
#arguments.abc#</cfoutput>
        </cffunction>
</cfcomponent>



***
The information in this email is confidential and intended solely for the
individual or entity to whom it is addressed. If you have received this
email in error please notify the sender by return e-mail, delete this email,
and refrain from any disclosure or action based on the information.
****


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[EMAIL PROTECTED] with the word '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]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word '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]

Reply via email to