Thanks Dan, Sean,

To take this a step further now, if you are mixing in a function into other
CFCs (by reference), and that function has code to set variables.xyz=123,
will that variable be stored in the proper CFC? Are there any threading
issues or potential conflicts with doing this if had, say, 100 objects all
sharing this function by reference?

Baz


On 10/12/07, Sean Corfield <[EMAIL PROTECTED]> wrote:
>
>
> On 10/12/07, Dan Wilson <[EMAIL PROTECTED]> wrote:
> > It is a pass by reference.  All complex types are passed by reference.
>
> Yup, functions are actually Java objects so they are passed around by
> reference.
>
> > (Except for Arrays of simple types on CFMX 6.1)
>
> Arrays are weird. They are shallow-copied on assignment. If you pass
> an array to a UDF/method, it shallow-copies it. If you return an array
> from a UDF/method, it shallow-copies it *if* the result is assigned.
>
> This means you can do weird stuff like this:
>
> <cfset arrayAppend(obj.callSomeFunc(),42) />
>
> This will actually update the array inside obj if you just return it like
> this:
>
> <cfreturn variables.myArray />
>
> However, if you do this:
>
> <cfset result = obj.callSomeFunc() />
>
> you get a copy of the array instead.
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to