My coworker was converting some CFCs from tags to script today and at the same adding some struct literals in. He came across a behavior that I didn’t expect, and I haven’t been able to find anything after a precursory bit of Googling (not sure what you search for, though).
Can anyone tell me if the code below is supposed to work or error? It currently errors, saying that “Variable FOO is undefined.”. I’m not even calling example2() which makes me think that the variables in the “args” struct literal are being bound at compile time and without regard to the other variables that will exist in the method at run time. Is that expected?
I’m on CF 9,0,1,274733
function example() {}
function example2() {
foo = ‘bar’;
example(args = {value = foo});
}
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com