From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29377 invoked from network); 29 Apr 2009 08:51:43 -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.4 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; 29 Apr 2009 08:51:43 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 17500 invoked from network); 29 Apr 2009 08:51:35 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 29 Apr 2009 08:51:35 -0000 Received: (qmail 15076 invoked by alias); 29 Apr 2009 08:51:29 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26897 Received: (qmail 15063 invoked from network); 29 Apr 2009 08:51:28 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 29 Apr 2009 08:51:28 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [208.87.233.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 3D7668028C71 for ; Wed, 29 Apr 2009 10:49:13 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly16g.srv.mailcontrol.com (MailControl) with ESMTP id n3T8njL4015659 for ; Wed, 29 Apr 2009 09:51:17 +0100 Received: from news01.csr.com ([10.99.50.25]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Wed, 29 Apr 2009 09:51:04 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.14.2/8.13.4) with ESMTP id n3T8p4Fh013331 for ; Wed, 29 Apr 2009 09:51:04 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.14.2/8.14.2/Submit) with ESMTP id n3T8p3m8013327 for ; Wed, 29 Apr 2009 09:51:04 +0100 Message-Id: <200904290851.n3T8p3m8013327@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: improve ${(q)...} In-reply-to: <090428153749.ZM8596@torch.brasslantern.com> References: <5191.1240937187@csr.com> <090428153749.ZM8596@torch.brasslantern.com> Comments: In-reply-to Bart Schaefer message dated "Tue, 28 Apr 2009 15:37:49 -0700." Date: Wed, 29 Apr 2009 09:51:03 +0100 From: Peter Stephenson X-OriginalArrivalTime: 29 Apr 2009 08:51:04.0580 (UTC) FILETIME=[A12ACC40:01C9C8A7] X-Scanned-By: MailControl A_08_51_00 (www.mailcontrol.com) on 10.71.0.126 X-Virus-Scanned: ClamAV 0.92.1/9301/Tue Apr 28 20:49:48 2009 on bifrost X-Virus-Status: Clean Bart Schaefer wrote: > } 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". I don't follow that. The quotation is present if the inner quotation would cause the word to behave differently when unquoted. Stripping multiple levels of quotation should therefore still work. Or are you thinking of things like the example below? > 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.) I won't rely on my expectation here---it's different with backslash quoting anyway. However, you've certainly spotted a case I hadn't where this changes the behaviour. I can look for different letters... Hmm, we could use qQ which is currently meaningless as a sort of shorthand for "minimal quoting"...? > 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". OK, I see you can claim the annoying inconsistency with backslash is a feature. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070