Technoclasm | A few thoughts about Coldfusion, Development and Life

Nov/09

25

Scoping Variables in Railo

Just a really quick one. I saw Andy Scott’s email about scopes and was reminded what was cool about Railo

In Railo administrator at Settings/Scope you can set the Local Scope Mode from update to always, this change how Railo use the local scope, after this change Railo write every un-scoped variable to the local scope, you no longer need the var or local. to write a variable to local scope, this makes code like this a much easier. Michael Offner-Streit

RSS Feed

2 Comments for Scoping Variables in Railo

Gary Gilbert | November 25, 2009 at 3:25 pm

Just be careful if you want your code to be backwards compatible you should still scope your variables.

Eric Cobb | November 25, 2009 at 4:35 pm

This can also break your applications in some cases. When I first installed BlogCFC, I had Local Scope mode set to “Always” for it, and it wouldn’t work. It kept throwing errors because it was expecting something to be in the variables scope that was no longer there. Switching Local Scope mode to “Update” fixed the problems.

Bottom line, always scope your variables and you won’t have to worry about these problems.

Leave a comment!

<<

>>

Find it!

Theme Design by devolux.org