From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22486 invoked by alias); 7 Feb 2016 19:24:27 -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: 37909 Received: (qmail 28956 invoked from network); 7 Feb 2016 19:24:25 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Originating-IP: [82.20.18.64] X-Spam: 0 X-Authority: v=2.1 cv=aIwN0uJm c=1 sm=1 tr=0 a=tQ56d2wE10i0ATcm3CvKvA==:117 a=tQ56d2wE10i0ATcm3CvKvA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=GumQ9EM2AAAA:8 a=n7_cRAeymoj7Er5wc18A:9 a=CjuIK1q_8ugA:10 Date: Sun, 7 Feb 2016 19:24:22 +0000 From: Peter Stephenson To: Zsh hackers list Subject: Re: unset "hash[key]" isn't matched with what "key" may be Message-ID: <20160207192422.4e7e7684@ntlworld.com> In-Reply-To: References: <20160207190822.7ba8de0e@ntlworld.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 7 Feb 2016 20:10:48 +0100 Sebastian Gniazdowski wrote: > I meant that "$i" iterates over keys of $functions Ah, you mean % i='opp+a[' % function 'opp+a[' { print Hi; } % 'opp+a[' Hi % unset "function[$i]" unset: function[opp+a[]: invalid parameter name That's because i is expanded first, so the brackets get confused. So you might expect i='opp+a\[' to work to compensate, but it doesn't. Nor does unset 'function[$i]' since there's no later expansion. No, I can't see an obvious answer either, and it's not specific to $functions, it happens with an ordinary hash. It's not actually clear to me what the right answer should be. Somehow you need to make the key stand out from the surrounding syntax. Allowing backslash quoting, which was the next guess, might be the asnswer, but see http://xkcd.com/1638 for commentary on backslashes. pws