bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Global variable modification by nameref chain


From: Dan Douglas
Subject: Re: Global variable modification by nameref chain
Date: Tue, 14 Jun 2016 11:16:45 -0500

On Sun, Jun 12, 2016 at 8:33 PM, Chet Ramey <chet.ramey@case.edu> wrote:
> 3. Honor the assignment and delete the nameref variable, creating a new
>    one, like bash-4.3:
>
> $ ../bash-4.3-patched/bash ./x1
> declare -n a="b"
> declare -n b="a[1]"
> declare -a a='([1]="foo")'
> declare -n b="a[1]"

I kind of like this option because it's consistent with `typeset -n`
meaning "operate directly on the ref variable", and declare together
with assignment meaning "redefine the variable" in most cases. I'm not
so sure a warning is needed since replacing the variable with a new
definition would be the usual thing to do with any other attributes,
and the identifier literals used within one scope should be under
control.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]