I'm curious about your reasoning behind that feeling. Passing objects by value makes perfect sense to me. If I want a reference to myarray than why don't I just call myarray? If I say thisotherarray = myarray then I'm copying myarray over because I'm presumably doing to do something else with it. If I want to do something with myarray then I should act upon myarray, not upon a reference to it.
Judah On Fri, Feb 13, 2009 at 2:05 PM, Peter Bell <[email protected]> wrote: > > I think passing arrays by value in ColdFusion only truly makes sense > to someone who's off their meds, but because it is the way things > work, it will continue to be the way things work to avoid breaking > legacy code. > > Best Wishes, > Peter > > On Feb 13, 2009, at 4:58 PM, Dan Wilson wrote: > >> >> Frankly Henry, the contents of the array matter. Coldfusion makes a >> copy of all simple types and passes a reference of all complex types. >> >> If you have an array of objects or structs, coldfusion will make a new >> array with a reference to the objects inside. Changing any of those >> objects will be reflected in both arrays. However, simple types are >> not passed by reference, so changing one of those would only be >> reflected inside the source array that was mutated. >> >> Make sense? >> >> >> Dan >> >> >> >> >> >> On 2/13/09, Henry <[email protected]> wrote: >>> >>> Anyone knows what's the reason behind passing array by value, not by >>> reference, in CF? >>> >>> I totally forgot about it today and it cost me valuable time... >>> >>> >>> Henry Ho >>>> >>> >> >> >> -- >> "Come to the edge, he said. They said: We are afraid. Come to the >> edge, he said. They came. He pushed them and they flew." >> >> Guillaume Apollinaire quotes >> >> > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
