Re: functions can fully unset local vars in other scopes

2022-07-29 Thread Kerin Millar
Hi Emanuele, On Fri, 29 Jul 2022 03:59:07 +0200 Emanuele Torre wrote: > Description: > `bash' does not let `unset' fully undeclare local variables. (so that > they can be used later as `local' variables without needing to > redeclare them I assume.) > > bash-5.1$ x=abc; declare -p x

Re: functions can fully unset local vars in other scopes

2022-07-29 Thread Martin D Kealey
On Fri, 29 Jul 2022 at 18:51, Kerin Millar wrote: > 5.0 added a localvar_unset option that impedes the behaviour of 'popping' > from the outermost scope. > > $ bash -c 'x=foo; f1() { local x=bar; f2; x=baz; }; f2() { unset x; > declare -p x; }; f1; declare -p x' > declare -- x="foo" > declare --

Re: functions can fully unset local vars in other scopes

2022-07-29 Thread Andreas Schwab
On Jul 30 2022, Martin D Kealey wrote: > *2: Adding a new global setting just adds yet another unreasonably > difficulty when sourcing files maintained by multiple authors into one > shell script program. It's not really different to the situation with perl or python. If you use a perl or python