Path: csiph.com!feeder.erje.net!2.us.feeder.erje.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!171.64.64.130.MISMATCH!usenet.stanford.edu!not-for-mail From: don fong Newsgroups: gnu.bash.bug Subject: Re: Unset array doesn't work Date: Wed, 28 Feb 2018 12:35:18 -0800 Lines: 31 Sender: dfong@dfong.org Approved: bug-bash@gnu.org Message-ID: References: <21679c48-4064-5683-2d5f-91bfb76687d0@case.edu> <790ade74-690f-541c-9ab4-6359917442d0@case.edu> <755d61fa-d2bc-8855-bc30-4388aff40691@gmail.com> <9974.1519637469@jinx.noi.kre.to> <15717.1519764581@jinx.noi.kre.to> <24248.1519844400@jinx.noi.kre.to> <20180228200051.ilzre3k4y7intd76@eeg.ccf.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1519850123 1541 208.118.235.17 (28 Feb 2018 20:35:23 GMT) X-Complaints-To: action@cs.stanford.edu Cc: "bash.bug list" To: Chester Ramey Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dfong-org.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=UF1eZQaQSbbBhFaHpQuHUN3nbpjR9dmlLjY09s4NsDk=; b=17UlQwLrg7jvb6KDjVetMculTO62XJUxS9UyedbWXs953IC8sB2fm5OrdqfY7RG74l kF4okaa8C7MNF4izBVMe05FRoV4fUz7yHGkd80iTx8ZYiQdpVG77sK+bhJi+RzOkw141 EA+JcMdk58w3pGM70vEtOEsEfvG5SAVYY4Smzvl5BYAq2V85YFd2oO7w+oU56YoBr1k/ kcf5G+P2pKqcvHX3NPvaVGHLMoZ6mWfNxIpU5Ee0zsmUNW7NwBUuDdaKliSGe3ViDdv1 AE86I7hd9yJpX0S0l/hfG0Lkmq453cLUVSMReb5JNLsplYthpkiFRA3GyG3A2ACjriLm 7+4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=UF1eZQaQSbbBhFaHpQuHUN3nbpjR9dmlLjY09s4NsDk=; b=EKnqMVCgAHiZoaK7Yljn2RKQZs80XmPYoECTUda8zVwAe9mirPyUCWJJXyAQVTRUWX imiQWie5JijzDTLJ6jlxf3zcR2fS8hLKGRIPs3daLiWzvAY8HmAtK/HFlacdPc9d+eZ2 hESqJPJ37gKO9+w937lxsola5ZHw5lNm7jLso9Wib3U1L/01mWs2I1THaslLChbFM+2P 6iEco6gsGGMaWGrI38As0umOoN+j9mKdvQiCRcbNb0vJ61fiuzqFc2LlmQ3kItUIo5y4 /uuHD2BeNRQOdJjntcV7pWAtVs+KrtWcPow7VW1zpPxUzp6iiZ7sWLfzKYCy530zSpoS 0IUg== X-Gm-Message-State: APf1xPCHSspneXLcGqb9lnL3g71od5sVh2Bixj6Pmypv7QVMqQW91Q6i N5Kwe2IJGs2hP4RLoaDVDDMmTCDY+KHhBw3xaUS6Jw== X-Google-Smtp-Source: AG47ELt316oS1LJhHxCgSZfL/QGHVfSx9heRHZEQrht4R3yVmbBKx8/dzyG+8hmDVwE3JoV+dY+zM6VHFPMwQcmjzFc= X-Received: by 10.55.221.209 with SMTP id u78mr28488819qku.232.1519850118875; Wed, 28 Feb 2018 12:35:18 -0800 (PST) X-Originating-IP: [2620:15c:2c1:200:2cf2:1d2:4756:3288] In-Reply-To: X-Google-Sender-Auth: -h0ETQw__H1PNANq8mWzoUhI_Ec X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::234 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:13777 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 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/ > >