On Fri, Aug 28, 2020 at 06:37:00PM +0300, Oğuz wrote:
> 28 Ağustos 2020 Cuma tarihinde Greg Wooledge <wool...@eeg.ccf.org> yazdı:
> > func1() {
> >   declare -n _func1_ref="$1"
> >   local _func1_i
> >   ...
> > }
> >
> This doesn't make the slightest sense. What is the point of having local
> variables then?

You need to distinguish between two types of functions: ones which
use namerefs, and ones which do not.

If a function doesn't use name references, then you may safely use
local variables with any names you like.  Nothing has to change.

If a function is going to use a name reference, then you need to
bullet-proof it from head to toe.  All local variables have to be
mangled to minimize the chance of collisions.  It's an entirely
different problem.

Reply via email to