From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 15239 invoked from network); 3 Jun 2021 13:14:25 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 3 Jun 2021 13:14:25 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1622726065; b=sjWFEt6ARpivutDJPsH/WYQ0Eqij5scYn0Stc/OZHvZmcJjRHzFe02dqeJmtQN7VbMmkL1p6yG HLdz1pBhzSXxoDzJcZzMIzwpeXYJs9c6zZh3bvoNa7M6W9iCv1hc6Avre38SY/sIV0WGD9xGp9 +Tg9jxx7FMLCE6SMkaHy4hUzSKDY73dtDmfJRI9WOnBoOrVhyLKA3WJtmoPvLyMsGj+XMQXtAc QQR8dXsB9K+UDDIyq1O1xoyrUVF1opRfrK5mmwQwEOvDHyPr7F9qynuG0nmMpixIhg34VlmUDs z0HPj868U9y4yTEyjcuFpR+moEuoufDN2mJuuQepGu6E7A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (relay2-d.mail.gandi.net) smtp.remote-ip=217.70.183.194; dmarc=none header.from=chazelas.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1622726065; bh=q3ww6EJEjeIXfvEEtYXbYi6WG80UomsUe57/OYLyxqU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature; b=uxZBaQv8lHd91k1uwKFW0TI+28eSSprx5unFtkOu64l1GWV7Au/TtBdCmvowV0qgi1NP/1Caq5 3DYsRUx1iHo9PlkimfecZ39mKoXTVQQsdafYcFGEXQQH24YqTNHEKMBwO0EiQOlEcIKzOzV8Fr GJSpEf2rJK1YkINd612HAOTa48lyb0V8AO/E5SzNUf1CIncss8VOFD2W3Zf89EMosFE7mkVCtE c+i9guEegYPz5D0ahclMCGhToOjpRZV56oNhMchIrPQgt0EKeSXZOHyFPZTCo+oFvI4LMEAMrE ve9cSphkVPiMqwdEcKAzUXam2PtCEXJXpI2V34jxKKbCqA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=livP5NMh5Eo6HDBTFhnSTahRWqzguSdyEyGhpq+pnvI=; b=VPcJmh76wx8P0Yiqd/716yodZT t5QjQ/xNeDP+uIhJFP+DP7G4poKYexcoxzvaA/D2BmP5YcY8DbJAAW9sBqHdL0J0aHqn2RCZz0OdC 7znW7v7dYbJOxlensChujj43CU8wdADLK89gHVZp2XLiMJEoL9miA6SI8Ea8Kn73ErmE2vIuWASAi CacGMLFy3qdyskMhZLEJZQ6/at7HWs4FPNz4HleSuX0ffU0LuoqwBWqLdJmjsr/3qqBuk/01Kg0yl QNxUpVbh6dRj94/pM0DWNuznTogpL7h2vg/zA0HKncKhG8uNL6zXRpDMsDBRZIhtpEF829YKBJ2oA wV9PyH5Q==; Received: from authenticated user by zero.zsh.org with local id 1lonB1-0009eK-Uy; Thu, 03 Jun 2021 13:14:23 +0000 Authentication-Results: zsh.org; iprev=pass (relay2-d.mail.gandi.net) smtp.remote-ip=217.70.183.194; dmarc=none header.from=chazelas.org; arc=none Received: from relay2-d.mail.gandi.net ([217.70.183.194]:35649) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1lonAT-0009LC-78; Thu, 03 Jun 2021 13:13:49 +0000 Received: (Authenticated sender: stephane@chazelas.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 7AC2840006; Thu, 3 Jun 2021 13:13:48 +0000 (UTC) Date: Thu, 3 Jun 2021 14:13:47 +0100 From: Stephane Chazelas To: Peter Stephenson Cc: Zsh hackers list Subject: Re: [PATCH (not final)] (take three?) unset "array[$anything]" Message-ID: <20210603131347.i7bv7ao7j3hk3a2e@chazelas.org> Mail-Followup-To: Peter Stephenson , Zsh hackers list References: <20210601053235.b4junj6muuwegl7b@chazelas.org> <20210602091145.xvyymjxdors6kqya@chazelas.org> <20210602142005.b5tw2hj2c6q3psqv@chazelas.org> <1629605749.599911.1622710481163@mail2.virginmedia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1629605749.599911.1622710481163@mail2.virginmedia.com> X-Seq: 49003 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: 2021-06-03 09:54:41 +0100, Peter Stephenson: > > On 03 June 2021 at 07:12 Bart Schaefer wrote: > > So, we're probably in pretty safe territory with either choice but in > > terms of backwards compatibility the stripquote version is slightly > > ahead. > > I'd be in favour of this. I agree with the consensus that the current code > is not really usable for difficult cases, so some degree of incompatibility > is warranted. [...] If I understand correctly, the "stripquote" variant is the one where the user can do: unset 'hash["foo"]' unset "hash['']" unset "hash[${(qq)key}]" That is where quotes are parsed and removed but otherwise serve no purpose. IMO, that just confuses things even more. That hardly helps with backward compatibility as users who did work around the previous behaviour will still have to adapt their work around, and those who didn't (who did unset "hash[$key]") will have their code choke on even more characters (", $, ' in addition to the previous ones, and likely more confusing behaviour when there are unmatched quotes or ()). It also deviates even more from the other places that take lvalues causing potential confustion. hash["foo"]=x or read 'hash["foo"]' set the element of key "foo" (quotes included) not foo. To me, acceptable options would be the "literal" one, or add another quoting flag (maybe "bb"?) that quotes in the manner currently expected by unset so people can use unset "hash[${(bb)key}]" (but unfortunately not read "hash[${(bb)key}]" for which $, ` also need to be escaped with backslash so that bb flag would only be useful for unset), or unset -k "$key" hash, or a new option à la bash. -- Stephane