[OpenSIPS-Users] routing function variable scope

Kingsley Tart kingsley at dns99.co.uk
Wed Apr 28 12:33:29 EST 2021


On Wed, 2021-04-28 at 15:27 +0300, Liviu Chircu wrote:
> On 28.04.2021 15:19, Kingsley Tart wrote:
> > Is there a better way, apart from trying to make sure that variables in
> > each function don't share names with variables in other functions?
> 
> No, you have to manage those iterator names and make sure the logic 
> still holds during nested calls.

Right OK. Is it a reasonable feature request to have a variable type
called $local that is only visible within the scope that created it? Or
at least, not outside of the function, so you could use $local(myname)
just like you would use $var(myname). Other functions could then share
the same name and it would be their own local copy.

If you think that's reasonable then I'll submit it.

I'm not sure how much work it would be to implement, however!

-- 
Cheers,
Kingsley.




More information about the Users mailing list