Just to clarify -- Ryan's right with regard to Structure's (if you're
passing a struct as an argument to your function), CFC's and COM/Java
objects. CFC's can't be duplicate()ed, so you have to write your own
clone() method to make that happen, but I digress... With simple
arguments (numbers, dates, strings) and with arrays, you don't need to
do this because these values are in essence automatically duplicated
when they're passed to the function. (Actually they're "passed by
value" but it has the same effect.)

> I would say that there is one case where you would need to
> create a
> local copy of a variable that you passed in.

> If you are passing in the name of a variable that you are
> going to use
> inside the function and then return a copy either as a
> copy or to
> overwrite the variable you passed in, you may want to
> create a local
> copy of it.

> For instance, if you had a function that was working with
> an object in
> the session scope, but you dont want to manipulate the
> session scoped
> object directly, you could pass in the session object,
> make a copy of
> it in your local method scope and then pass out the object
> where you
> could overwrite the original with the changes.  This keeps
> the
> original from being used in the meantime while only some
> of the
> manipulations have been made.

> But for most cases, no, you dont need to create a local
> copy of arguments.



s. isaac dealey     954.522.6080
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217291
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to