I honestly can't believe someone actually designed it this way at ACF.
I mean how confusing do you want to make a language? We all know some
of the other quirks of the language which again, we've discussed
historically on this list.
Complex types should _always_ be passed by reference, never by value.
The fact they do in certain circumstances is just wrong. The vast
majority of languages operate this way.
However, we do support this "wrongness" - ACF of passing an array by
value to UDF functions. Trust me, that is a whole host of code we
would like to rip out of the engine/language. Instead we provide a
means to turn this off, which is a flag i have flipped all the time.
The issue however isn't that passing arrays by value is wrong, what is
wrong, is that ACF has failed to be consistent across everything. Why
should a UDF function be different from a built-in function? This just
makes it harder for the poor CFML developer to figure out whats-what.
Another area that they fail to provide is named-arguments for core
functions (something we do).
CFML is meant to be easy, straight forward and powerful. We don't need
these quirks.
AlexS wrote:
Sorry the test case WW has posted doesn't show the whole picture but
her description does describe that this involves a method.
What we're seeing is that if the VAR keyword is not used then the
array is passed by Value into the function which is consistent with
normal Coldfusion behaviour.
However when the VAR keyword is used then it passes by reference.
Where as obviously with Structs in both instances its passed by
reference
Also note this url
http://www.bennadel.com/blog/141-ColdFusion-Arrays-Passed-By-Value.htm
which describes the scenario but actually I don't believe Open BD is
exhibiting this behaviour which i believe it should.
I haven't confirmed that CF9 behaves the same way but the inclusion of
not of the VAR keyword effecting arrays in this way to me seems odd.
A
--
official tag/function reference: http://openbd.org/manual/
mailing list - http://groups.google.com/group/openbd?hl=en