From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26648 invoked from network); 28 Apr 2009 22:38:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 Apr 2009 22:38:34 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 53464 invoked from network); 28 Apr 2009 22:38:29 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 Apr 2009 22:38:29 -0000 Received: (qmail 26582 invoked by alias); 28 Apr 2009 22:38:23 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26896 Received: (qmail 26570 invoked from network); 28 Apr 2009 22:38:22 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 28 Apr 2009 22:38:22 -0000 Received: from vms173019pub.verizon.net (vms173019pub.verizon.net [206.46.173.19]) by bifrost.dotsrc.org (Postfix) with ESMTP id 9CFC98028C71 for ; Wed, 29 Apr 2009 00:35:46 +0200 (CEST) Received: from torch.brasslantern.com ([96.249.201.13]) by vms173019.mailsrvcs.net (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTPA id <0KIU00HMZ1J3ADMT@vms173019.mailsrvcs.net> for zsh-workers@sunsite.dk; Tue, 28 Apr 2009 17:37:52 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id n3SMboUd008598 for ; Tue, 28 Apr 2009 15:37:50 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id n3SMbnYg008597 for zsh-workers@sunsite.dk; Tue, 28 Apr 2009 15:37:49 -0700 From: Bart Schaefer Message-id: <090428153749.ZM8596@torch.brasslantern.com> Date: Tue, 28 Apr 2009 15:37:49 -0700 In-reply-to: <5191.1240937187@csr.com> Comments: In reply to Peter Stephenson "PATCH: improve ${(q)...}" (Apr 28, 5:46pm) References: <5191.1240937187@csr.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: improve ${(q)...} MIME-version: 1.0 Content-type: text/plain; charset=us-ascii X-Virus-Scanned: ClamAV 0.92.1/9301/Tue Apr 28 20:49:48 2009 on bifrost X-Virus-Status: Clean On Apr 28, 5:46pm, Peter Stephenson wrote: } } It's annoyed me for a while now that single-quoting a value uses } single quotes even where they're not needed, and with existing single } quotes in the value at the start or end you get something quite messy. Hmm. } This fixes the problem. Is there a good reason for making this a } different flag, or is altering (q) good enough? I couldn't think of a } reason why you would need it to be verbose The proposed patch changes the behavior of nested (q) options rather significantly. E.g., ${(qqq)${(qq)v}} becomes very different. This could be important if the resulting string is going to be processed with "eval". Also keep in mind what happens when strings are catenated by adjacency. x=\$foo y=bar foo=this foobar=that eval print ${x}${(qq)y} Would you really expect "that" rather than "thisbar"? (Admittedly an edge case.) Although it's true that we never "guaranteed" the quoting behavior, it's implicit in the doc: ... If this flag is given twice, the resulting words are quoted in single quotes and if it is given three times, the words are quoted in double quotes ... Note it *doesn't* say "as if in quotes". Wrapping the entire string is also consistent with (qqqq), which is distinct from (q) which applies $'...' only where needed.