[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: declare [-+]n behavior on existing (chained) namerefs
From: |
Chet Ramey |
Subject: |
Re: declare [-+]n behavior on existing (chained) namerefs |
Date: |
Thu, 5 May 2016 14:59:23 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:45.0) Gecko/20100101 Thunderbird/45.0 |
On 5/2/16 1:55 PM, Piotr Grzybowski wrote:
> Hi,
>
> I hope the attached patch does not break to much; it addresses the masking:
>
>> declare -nt r=a; f() { declare a; declare -n r=a; declare -p a r; }; f
>
> as per Grisha's report; it tries to enlighten make_local_variable to the
> existence of nameref by returning existing local nameref in scope (declare -n
> r=PATH; declare -n r; returns r with value of PATH) and by (hopefully)
> correctly making existing nameref take precedence over the dereferenced value.
>
> Would you please consider it?
Thanks, this is a good fix.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/