In the past, I've mentioned how CF will pass a structure by reference if you do something like the following:
a = structNew();
b = a;
However, a coworker found something interesting. Inside a UDF, she did something like so:
var a = structNew();
a.orig = "foo";
application.foo = a;
What was interesting was that even though 'a' was a var scoped variable, the value of application.foo still existed after the request. I did another test and discovered that even outside of a UDF, if you set an application struct to point to a variables scope struct, the "death" of the variables scope struct simply "tears off" a copy to the application scope. I can't see a real use for this, but I figured I'd share it.
Updated Even more interesting, if you make B point to A, ie, a is a struct, b = a, and then change the type of a, than CF "tears" it again. Consider:
s = structnew();
s.name = "orig";
b = s;
s=arraynew(1);
writeoutput(b.name);
This will output orig and not throw an error as you might expect.