[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: declare [-+]n behavior on existing (chained) namerefs
From: |
Piotr Grzybowski |
Subject: |
Re: declare [-+]n behavior on existing (chained) namerefs |
Date: |
Sat, 30 Apr 2016 18:58:35 +0200 |
hi,
this one is not present in current devel, I would consider it fixed already.
pg
On 29 Apr 2016, at 18:50, Grisha Levit wrote:
> I should note also that the behavior when inside a function matches exactly
> what the manual says. It’s the global namerefs that have this unexpected
> behavior of following the chain to the end and and modifying only the last
> nameref in the chain.
>
> The only buggy behavior when inside of functions (ignoring scope issues)
> seems to be that `declare -n ref’ unsets the value of $ref if it previously
> pointed to a variable that is unset.
>
> $ f() { unset var; declare -n ref=var; declare -n ref; declare
> -p ref; }; f
>
> declare -n ref # why did the value of ref disappear?
>
>
> $
> f() { local var; declare -n ref=var; declare -n ref; declare
> -p ref; }; f
>
> declare -n ref="var"