From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4095 invoked by alias); 9 Feb 2016 15:50: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: 37931 Received: (qmail 18893 invoked from network); 9 Feb 2016 15:50:45 -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,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=XaTfwAEUcmXOxVPg/RbLObXuwipuqpQaeUXgg4E7Xp0=; b=BEQUrGCHVnk7SvWSD2Hr6ZPMFAmH7YBCSG0aF+aAfhqtfUKhqD24MQBoqOfvpU+iNs N8inQbtXDg4tjtkB2gnUKkW7yRyc+ihkpFJmHKD1sYItZLN6DYzeAgFt7NN9TIWuI/CX 4gvss6zMOcfJ3vurvwwQea5hWyPfSh85D3S5H9+R5SfOE4ZUbHFJ8RwSBpdLbziKoKn5 +Hpo0n6r6x0k4OGKMNf1KubsYNx9GJUcCevaCb+QxqkwLLElHxFHJVUnM46fvKMGzB4N dP0v4WqCHiPMcFso5pFmi+7Wm9SMKVlqogAR5mXWpkHywsTyUSgJawXC+MThjAw1u6ny fsfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=XaTfwAEUcmXOxVPg/RbLObXuwipuqpQaeUXgg4E7Xp0=; b=YPk6m/GWV46+jVU825eAmfWJ8/ZLudUnnLDvkoi49gMeKIdH25OuUnUgfCpA7Rf8Ji O820MV2/InCBBU6Eb5uAHSOjl8Fyk+GpI5JqXIpkcevyYi0AXar6AzaORIi9L8jXn9Ln sam3v8osZgURc90sOPbyoxbB8ouY2KbkgQ/1NIZWkT7Kuh9CJAGYrwLiuxlnsT2QS2tj AF5u0rb57FLsAUexrv69B20JeaAGsu3vJl8pxKUGT7OhPeKkiJESj3nTPs6D6LeuSwHM 8Pw02mUmIc58Qnjon5saHu5Y7dzDeiguTSXXUlP5Ov8TXiauPjdcIbAuNDzrIXty+Zju q/2Q== X-Gm-Message-State: AG10YOTXsRe8wcfpO/VcVJe6UbxOdR28PRrXYpVNVDoEW0DhhyrOAbk3TiYheUfQvcT7NQ== X-Received: by 10.98.18.201 with SMTP id 70mr51569429pfs.104.1455033043017; Tue, 09 Feb 2016 07:50:43 -0800 (PST) From: Bart Schaefer Message-Id: <160209075050.ZM30873@torch.brasslantern.com> Date: Tue, 9 Feb 2016 07:50:50 -0800 In-Reply-To: <20160209085356.5d9b7401@pwslap01u.europe.root.pri> Comments: In reply to Peter Stephenson "Re: unset "hash[key]" isn't matched with what "key" may be" (Feb 9, 8:53am) References: <160207133307.ZM31008@torch.brasslantern.com> <160207230544.ZM10065@torch.brasslantern.com> <160208205418.ZM27521@torch.brasslantern.com> <20160209085356.5d9b7401@pwslap01u.europe.root.pri> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh hackers list Subject: Re: unset "hash[key]" isn't matched with what "key" may be MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 9, 8:53am, Peter Stephenson wrote: } Subject: Re: unset "hash[key]" isn't matched with what "key" may be } } All that occurred to me was an additional option to provoke an extra } expansion step on the argument after locating the brackets. } } unset -? 'hash[$i]' } } would then be reliable. If the extra backslash stripping occurred early } enough it wouldn't get in the way. So what magic makes this work for typeset? torch% typeset -A foo torch% x='[' torch% typeset "foo[$x]" zsh: not an identifier: foo[[] torch% typeset 'foo[$x]' <-- note here torch% typeset -p foo typeset -A foo=( '[' '' ) torch% Or perhaps an equally interesting question is, is that behavior in fact incorrect and typeset shouldn't do it either? Ksh: $ x='[' $ typeset -A foo $ typeset "foo[$x]" ksh: typeset: foo[[]: invalid variable name $ typeset foo[$x] <-- not an error? $ typeset -p foo typeset -A foo=(['[]']=) <-- but weird $ typeset 'foo[$x]' $ typeset -p foo typeset -A foo=(['$x']= ['[]']=) <-- no expansion $