On Fri, Aug 12, 2016 at 09:34:40AM -0400, Chet Ramey wrote: > On 8/10/16 12:06 PM, Andreas Kusalananda Kähäri wrote: > > > Bash Version: 4.3 > > Patch Level: 46 > > Release Status: release > > > > Description: > > When declaring a variable in a function as a nameref, it can not > > be dereferenced if the variable it's a nameref to happen to have > > the same name as the nameref itself. This imposes unnecessary > > restrictions on the caller. > > There was extensive discussion about namerefs on bug-bash earlier this > year. I have a reasonable suggestion about how to change this behavior, > and I will be looking at it after bash-4.4 is released.
Thanks Chet. I'm mostly a ksh user, and the background to my report above is that I was trying to make a tiny library of shell functions for manipulating PATH-like shell variables available to bash users while still maintaining functionality in both shells. All functions were using a local nameref called "var" and the issue came up when one function tried to use one of the others. My workaround is currently to slightly obfuscate the name of the local nameref previously called "var" in each function so that their names won't clash within the library and so that it's less likely that they clash with global variables in the shell. I'm looking forward to a future bash release! Regards,
signature.asc
Description: PGP signature