Lets look at the difference between a function that works on
variables vs. one that works on an array. ucase(attribute)
returns the attribute after it has been made all uppercase.
ArrayResize(array, minimum_size) - this will resize the array
that you pass to it. The array is NOT returned
is the Force, and a powerful ally it is. - Yoda
-Original Message-
From: Michael Dinowitz [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 3:44 PM
To: CF-Talk
Subject: RE: Passing variables in UDF
While I can understand this in a UDF, I just can't understand
why
Are variables passed by reference or by value in CF UDFs?
Queries, structures, and variables created using CFOBJECT
are passed by reference. Other variables are passed by value.
This is true whether passing them to UDFs or custom tags or
whatever, as far as I can tell.
While I
Of course, in the long run, it really doesn't matter, as long as we know
what behavior to expect. However, there are useful benefits to passing
structures by reference to custom tags. For example, let's say we wanted to
filter input. Ideally, we could use an external component for that, since
Simple variables are passed by value. Complex variables (query, structure,
array) are passed by reference. I think that object variables are also
passed by reference.
At 01:24 PM 9/10/01, you wrote:
Are variables passed by reference or by value in CF UDFs?
Thanks,
If the var is simple or array, then it is by value. If you pass in a
struct or a query, then it is by ref.
===
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia
Email: [EMAIL PROTECTED]
Yahoo IM :
Are variables passed by reference or by value in CF UDFs?
Queries, structures, and variables created using CFOBJECT are passed by
reference. Other variables are passed by value. This is true whether passing
them to UDFs or custom tags or whatever, as far as I can tell.
Dave Watts, CTO, Fig
I was wrong in saying that an array was passed by reference. I just tested
it out and it is passed by value. I was assuming based on the normal array
function results that it would be. I hate when things are not 'standard'.
Causes an error
CFSCRIPT
function test(aVar)
{
While I can understand this in a UDF, I just can't understand why this is
true for a custom tag. I just tried it out and an array is passed by value
to a custom tag. A structure is passed by reference. This totally breaks
the paradigm of custom tags being totally independent processes.
At
They are passed by value. You can see this from this simple code:
===
cfscript
function AddOne(n)
{
return n+1;
}
/cfscript
cfset num=1
cfoutputn+1=#AddOne(num)#br
num=#num#/cfoutput
===
HTH,
Thanks, Micheal.
I appreciate taking the time to do the fieldwork :).
EC
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 3:35 PM
To: CF-Talk
Subject: RE: Passing variables in UDF
I was wrong in saying that an array
, September 10, 2001 1:35 PM
To: CF-Talk
Subject: RE: Passing variables in UDF
I was wrong in saying that an array was passed by reference. I just tested
it out and it is passed by value. I was assuming based on the normal array
function results that it would be. I hate when things are not 'standard
of the string
variable in the calling page.
--
I shoulda looked it up sooner. Sorry... grins
Shawn Grover
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 1:35 PM
To: CF-Talk
Subject: RE: Passing variables in UDF
I
I was wrong in saying that an array was passed by reference.
I just tested it out and it is passed by value. I was assuming
based on the normal array function results that it would be. I
hate when things are not 'standard'.
I'm not sure I understand what you mean by this (that is, based
Lets look at the difference between a function that works on variables vs.
one that works on an array.
ucase(attribute) returns the attribute after it has been made all uppercase.
ArrayResize(array, minimum_size) - this will resize the array that you pass
to it. The array is NOT returned as a
15 matches
Mail list logo