[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: namref dicussion continued: [PATCH] export -r reference
From: |
Chet Ramey |
Subject: |
Re: namref dicussion continued: [PATCH] export -r reference |
Date: |
Sun, 8 May 2016 19:28:18 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.0 |
On 5/4/16 12:30 PM, Piotr Grzybowski wrote:
> Hey,
>
> after another discussion with Grisha, and following one of his remarks, I
> kindly request your opinion on the attached patch (like: bad, not needed,
> already done, weak as it stands, harmful, etc.). It addresses the exporting
> of identifiers with have nameref attribute set.
> at the moment we have:
>
> #a=10; declare -nx ra=a; bash -c 'echo "a:$a, ra:$ra, ra_excl:${!ra}."'
> a:, ra:a, ra_excl:.
> #a=10; declare -n ra=a; export ra; bash -c 'echo "a:$a, ra:$ra,
> ra_excl:${!ra}."'
> a:10, ra:a, ra_excl:10
I'm not going to add another option to export before bash-4.4 is released.
This discussion, as useful as it's been, has already delayed the release
too long.
The above behavior is a pretty straightforward application of the nameref
rules: in the first case, ra is assigned `a' but never dereferenced; in
the second case, `ra' is dereferenced when used as the argument to
`export'. `unset' works the same way. bash and ksh93 work the same with
the second case, though ksh93, for some reason, doesn't allow -nx in any
combination as options to typeset.
--
``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/
- namref dicussion continued: [PATCH] export -r reference, Piotr Grzybowski, 2016/05/04
- Re: namref dicussion continued: [PATCH] export -r reference, Dan Douglas, 2016/05/04
- Re: namref dicussion continued: [PATCH] export -r reference, Piotr Grzybowski, 2016/05/05
- Re: namref dicussion continued: [PATCH] export -r reference, Piotr Grzybowski, 2016/05/05
- Re: namref dicussion continued: [PATCH] export -r reference, Dan Douglas, 2016/05/05
- Re: namref dicussion continued: [PATCH] export -r reference, Dan Douglas, 2016/05/05
- Re: namref dicussion continued: [PATCH] export -r reference, Chet Ramey, 2016/05/08
- Re: namref dicussion continued: [PATCH] export -r reference, Dan Douglas, 2016/05/09
Re: namref dicussion continued: [PATCH] export -r reference,
Chet Ramey <=