From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21836 invoked by alias); 22 Feb 2012 05:01:47 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30250 Received: (qmail 19390 invoked from network); 22 Feb 2012 05:01:46 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120221210106.ZM13374@torch.brasslantern.com> Date: Tue, 21 Feb 2012 21:01:06 -0800 In-reply-to: Comments: In reply to Daniel Lin "let unset array element remove compatible with bash" (Feb 22, 3:28am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: let unset array element remove compatible with bash MIME-version: 1.0 Content-type: text/plain; charset=us-ascii [Moved to -workers for discussion] On Feb 22, 3:28am, Daniel Lin wrote: } } Can any developer consider to enhance zsh's function like "unset var[2]"? Hmm, what's the reason NOT to do this? I can think of one: "unset var[9]" might cause elements 2 through 8 to spring into existence, which is surely counter-intuitive ... but of course the same thing happens with var[9]=(). @@ -3049,8 +3063,14 @@ } paramtab = tht; } else { - zerrnam(name, "%s: invalid element for unset", s); - returnval = 1; + char *arr[1]; arr[0] = 0; + *ss = '['; + if (assignaparam(s, zarrdup(arr), 0)) { + returnval = 0; + } else { + zerrnam(name, "%s: invalid element for unset", s); + returnval = 1; + } } } else { if (unsetparam_pm(pm, 0, 1))