Localmode

What does “localmode=true” means?

I see it in some function attributes definition like https://github.com/lucee/Lucee/blob/master/core/src/main/cfml/context/doc/Application.cfc

Example :


function getPackages() localmode=true {…}


According to documentation ( “https://docs.lucee.org/reference/tags/function.html” ) it should be a string value with accepted values such as “classic” or “modern” only.

Please advise.

Thank you

it automatically assigns variables in a function to the local scope

1 Like

Thanks for reply, yes that what it says in documentation, it just was strange to see attribute value TRUE.

But I believe it still better from performance point to use scope like arguments, variables … ?

yes it is always better, you can see in the debugging if you enable implicit variable access

that said, it’s not going to make so much of a difference unless the code is called a lot,

localmode=“modern” is also about avoiding overwriting other variables outside the function which can cause strange and hard to debug errors

1 Like