[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Incorrect / Inconsistent behavior with nameref assignments in functi
From: |
Chet Ramey |
Subject: |
Re: Incorrect / Inconsistent behavior with nameref assignments in functions |
Date: |
Mon, 31 Aug 2020 11:23:57 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 |
On 8/28/20 11:28 AM, Greg Wooledge wrote:
>
> You've got a local variable with the same name as the global variable
> that you're attempting to pass by reference. This will not work.
>
> Namerefs (declare -n) in bash are *not* like uplevel commands in Tcl.
> They cause the referenced variable name to be evaluated just like any
> other variable would be, starting at the current function scope, then
> going up to the caller, and so on.
Namerefs don't change bash's dynamic variable scoping. The two conflict
and make namerefs less useful than they might be.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
- Re: Incorrect / Inconsistent behavior with nameref assignments in functions, (continued)
Re: Incorrect / Inconsistent behavior with nameref assignments in functions, Binarus, 2020/08/28
Re: Incorrect / Inconsistent behavior with nameref assignments in functions,
Chet Ramey <=
Re: Incorrect / Inconsistent behavior with nameref assignments in functions, Koichi Murase, 2020/08/28
Re: Incorrect / Inconsistent behavior with nameref assignments in functions, Chet Ramey, 2020/08/31