[mailto:[EMAIL PROTECTED]
Sent: 08 September 2004 22:31
To: CF-Talk
Subject: Re: reference in cfc
Thanks for the reply.I did understand that, I guess what I am trying
to
get to is that I thought CF Components would return copies of the
data.
If I ask an object to return data to a template (display
To try in simplify Jim's explanation (I hope).In ColdFusion, structures are passed by reference.Thus if you do something like this:
cfset struct_1 = strutNew()
cfset struct_2 = struct_1
Both variables reverence the some data in memory, even if one of the variables is private to a function,
No. not really.
When you var a variable you do, indeed, make it private to the function.
However if you place a reference to a public object in a var'd variable it's
still a public object.
In a sense the var keyword only affects the actual label of the variable,
not its contents.It does not make
Hey Jim,
Thanks for getting back to me.Unfortunately it does make sense.I really thought (and was hoping) that when you ask a function for some data that it returns a copy of that data not a reference to that objects data.What is the standard practice for this?How do you truly protect an objects
If you really want a copy, you can use duplicate().That won't for
object instances though, if you want to duplicate those, you have to
write a clone method of some sort.
cheers,
barneyb
On Wed, 08 Sep 2004 16:02:56 -0400, Michael Hodgdon [EMAIL PROTECTED] wrote:
Hey Jim,
Thanks for getting
I definitely thought of using duplicate in my get methods so that we are returning a true duplicate, but isn't there known issues with duplicate?Is the duplicate function corrected in the 6.1 updater?
If you really want a copy, you can use duplicate().That won't for
object instances though, if
-Original Message-
From: Michael Hodgdon [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 08, 2004 4:03 PM
To: CF-Talk
Subject: Re: reference in cfc
Hey Jim,
Thanks for getting back to me.Unfortunately it does make sense.I
really thought (and was hoping) that when you ask a function for some
or Duplicate to make a copy if that's what you
wanted.
http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/functa91.htm
Joe
-Original Message-
From: Michael Hodgdon [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 08, 2004 4:03 PM
To: CF-Talk
Subject: Re: reference in cfc
In general you DON'T want a copy, you want a pointer.The only time
you'd want a copy is if you're going to change the data, but you don't
wany anyone else to know that you've changed it until some later time.
cheers,
barneyb
On Wed, 08 Sep 2004 16:31:11 -0400, Michael Hodgdon [EMAIL PROTECTED]
gotcha, thanks, it is all coming back to me.
In general you DON'T want a copy, you want a pointer.The only time
you'd want a copy is if you're going to change the data, but you
don't
wany anyone else to know that you've changed it until some later time.
cheers,
barneyb
On Wed, 08
10 matches
Mail list logo