Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #13777

Re: Unset array doesn't work

From don fong <dfong@dfong.com>
Newsgroups gnu.bash.bug
Subject Re: Unset array doesn't work
Date 2018-02-28 12:35 -0800
Message-ID <mailman.9905.1519850123.27995.bug-bash@gnu.org> (permalink)
References (6 earlier) <9974.1519637469@jinx.noi.kre.to> <15717.1519764581@jinx.noi.kre.to> <24248.1519844400@jinx.noi.kre.to> <20180228200051.ilzre3k4y7intd76@eeg.ccf.org> <b4615d2e-cf2f-ea60-c8c6-44b6eb8dba76@case.edu>

Show all headers | View raw


seems like it would be helpful to explain this behavior more clearly in the
man page.




On Wed, Feb 28, 2018 at 12:14 PM, Chet Ramey <chet.ramey@case.edu> wrote:

> On 2/28/18 3:00 PM, Greg Wooledge wrote:
>
> > Does unset create some kind of "placeholder" in the current function
> > (but not in a caller)?
>
> Yes, that's what I said. In the current scope, unset arranges for the
> variable to appear unset. In a previous scope, unset just removes the
> variable, which uncovers an instance of the variable at a (further)
> previous scope.
>
> It looks like I added that code in 1995. The code before that was "pure"
> dynamic scoping, in the sense that it just removed the variable and
> `uncovered' a previous scope's value no matter where the variable was
> declared. It seems like I added the special case for several reasons,
> but there's no indication of widespread user complaint about the behavior
> of `unset'. (Of course, that was a long time ago.)
>
> --
> ``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/
>
>

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Unset array doesn't work don fong <dfong@dfong.com> - 2018-02-28 12:35 -0800

csiph-web