[Top][All Lists]

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

Re: nameref bug?

From: Chet Ramey
Subject: Re: nameref bug?
Date: Wed, 03 Sep 2014 15:21:53 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 9/3/14, 1:14 PM, lolilolicon wrote:

> Yes, they're convenient, and make the code look somewhat more
> readable, compared to equivalent `eval` or `printf -v` statements.
> Functionally, they're all the same.
> And they all suffer from the same issue. No matter which of those
> three is used, one has to be very careful not to create name
> collisions which can result in non-obvious bugs, sometimes deep in the
> function call stack. One will have to invent his own variable naming
> conventions to avoid such bugs; for instance, I have written a
> reminder for my own script,
> https://github.com/lolilolicon/FFcast/blob/master/HACKING.markdown

I think that is a consequence of mixing bash's dynamic scoping with the
ksh93-derived nameref feature.  It's simpler in ksh93, which uses static

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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