[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
should `local' create local variables when they exist in the tempenv?
From: |
Grisha Levit |
Subject: |
should `local' create local variables when they exist in the tempenv? |
Date: |
Sun, 9 Dec 2018 01:30:53 -0500 |
When a variable is present in the temporary environment and then declared
local in a function, it seems to not actually make a local variable, in the
sense that the variable does not show up in the output of `local',
unsetting
the variable reveals the variable from the higher scope rather than marking
it invisible, etc.
$ f() { local v=x; local -p; }; v=t f
$ f() { local v; declare -p v; }; v=t f
declare -x v="t"
$ f() { local v=x; unset v; declare -p v; }; v=g; v=t f
declare -- v="g"
Is this intentional?
- should `local' create local variables when they exist in the tempenv?,
Grisha Levit <=