bug-bash
[Top][All Lists]
Advanced

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

Re: issues with nameref resolution loop in a function


From: Chet Ramey
Subject: Re: issues with nameref resolution loop in a function
Date: Tue, 11 Dec 2018 14:36:55 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 12/8/18 8:30 PM, Grisha Levit wrote:
> There seems to be an issue with the following new bash-5.0 feature:
> 
>   A nameref name resolution loop in a function now resolves to a variable by
>   that name in the global scope.
> 
> [ Note: "warning: x: circular name reference" messages omitted below. ]
> 
> While referencing such a nameref works as described, scalar assignment to it
> modifies the variable from the next higher scope rather than the global one:

Yes, that's what it does right now. The resolution change is the only one I
made, and I'm still not convinced it's the right thing. The code that does
the assignment is unchanged, with a comment that says backwards
compatibility.

That code can operate on the global instance, ignore the nameref attribute
and change the value, or just ignore the variable as if it didn't exist.
Right now it does what it did in bash-4.4.

(Cue Greg and his "nameref variables are an unworkable botch and should
just be ignored.")

-- 
``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/



reply via email to

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