From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18170 invoked by alias); 23 Apr 2018 10:06:55 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23362 Received: (qmail 15328 invoked by uid 1010); 23 Apr 2018 10:06:55 -0000 X-Qmail-Scanner-Diagnostics: from mailout2.w1.samsung.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(210.118.77.12):SA:0(-6.9/5.0):. Processed in 2.086153 secs); 23 Apr 2018 10:06:55 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS,SPF_PASS,T_DKIMWL_WL_HIGH,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: p.stephenson@samsung.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180423100648euoutp02e1b1853316ea8e77875b1497e3e73309~oCKv8R2cz1947919479euoutp02c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1524478008; bh=udIa+jHvWn0xpUh5c+qtqMnUfkMFdxmVe2A8KCtu650=; h=Date:From:To:Subject:In-reply-to:References:From; b=PCPX3TdCL//v2gq7GcIsb5Z4LYHR205fbL0clWjSKvnL/TwIL47xNO1+ISAIbozgH ZfIbnXiOsT6ga0G+X3efbWwm1zErqIGXuA36MkwNJxiYOd9mTx0EsCzqBaHLE0P9n3 Whp+d5e6ec0iy3acvYSNqzY/vAVEszMep1YVPWQM= X-AuditID: cbfec7f5-f95739c0000028a9-c3-5addb0357133 Date: Mon, 23 Apr 2018 11:06:42 +0100 From: Peter Stephenson To: Zsh Users Subject: Re: zsh at perl conference and few questions Message-id: <20180423110642.0e0a5ebe@camnpupstephen.cam.scsc.local> In-reply-to: <20180422204849.GA30387@prometheus.u-strasbg.fr> Organization: SCSC X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKIsWRmVeSWpSXmKPExsWy7djP87qmG+5GGcx6LGqx4+RKRgdGj1UH PzAFMEZx2aSk5mSWpRbp2yVwZbxY1stSsFC0YtmhrYwNjOsEuhg5OSQETCTuvJ7CDGILCaxg lLg3R7eLkQvI7maSmHHgJjtMUdObLewQiWWMEltnNjFBOFOYJCacXwflnGGU2LbtCCuEc4FR 4tG5JhaQfhYBVYndWycwgdhsAoYSUzfNZgSxRQQUJc78+gYWFxYwlWhdeBZsH6+As8S5lUfB juIUsJVouzeZrYuRg4NfQEjiQrMtxEn2Ekf3nGSCKBeU+DH5HtgqZgEdoBses0PY8hKb17xl BrlHQmAGm8Sal01sEM0uEp/WfYT6TVji1fEtULaMRGfHQSaIhmZGibX370M19DBKzFocCmFb S/TdvsgIsYFPYtK26cwgx0kI8Ep0tAlBlHhI3Jo8gRHCdpTY0TyBBRIoExglevc8YJzAKD8L yeGzkBw+C8nhCxiZVzGKp5YW56anFhvnpZbrFSfmFpfmpesl5+duYgRG/ul/x7/uYNz3J+kQ owAHoxIP7w7du1FCrIllxZW5hxglOJiVRHiL/YBCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeeM0 6qKEBNITS1KzU1MLUotgskwcnFINjNP5tjX4/3l3cP/Bf+Fepl4P7UMljbWF0s4YmD3daSVx R24Pr7JEf4Xn3s5zcx4oarxU+Pg/NS9z/zVp/iwmeeX+B60XtHY+60pbXFp362ZTSd5hk7vT n6klzgpbl3HF5WvOxIBf01zNMufej3ssd+hGlWHMLZ7ufL/nFnEpeiUq7N4O9qU/lFiKMxIN tZiLihMBnvi40PgCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMLMWRmVeSWpSXmKPExsVy+t/xy7omG+5GGaxuULTYcXIlowOjx6qD H5gCGKO4bFJSczLLUov07RK4Ml4s62UpWChasezQVsYGxnUCXYycHBICJhJNb7awdzFycQgJ LGGU2LbvEhOEM41JYtWTrcwQzjlGie5r55hBWoQELjBK9D+zBrFZBFQldm+dwARiswkYSkzd NJsRxBYRUJQ48+sbWFxYwFSideFZdhCbV8BZ4tzKo2BzOAVsJdruTWaDWDCJUeLMosOsXYwc HPwCQhIXmm0hzrOXOLrnJBNEr6DEj8n3WEBsZgEtic3bmlghbHmJzWveQt2mLnHj7m72CYxC s5C0zELSMgtJywJG5lWMIqmlxbnpucWGesWJucWleel6yfm5mxiBQbvt2M/NOxgvbQw+xCjA wajEw7tD926UEGtiWXFl7iFGCQ5mJRHeYj+gEG9KYmVValF+fFFpTmrxIUZpDhYlcd7zBpVR QgLpiSWp2ampBalFMFkmDk6pBkbNnx4Pledv+HqKc9KDO1fY99qlPriokPanUGRWeO88m0sS nHNlbjx0aijYpP73X98LNjnx0zPn9Nir22RdzPJtiq6fzOthm7At8kTpvyU5yw/+/LFp+skw tYmi/V5zXaSct7aLbrXlP27oeu2B1YaYZwu+lTY+eXg4av3ru16BDs/dNGeuZi5TYinOSDTU Yi4qTgQAXBHn2FYCAAA= X-CMS-MailID: 20180423100644eucas1p1973f7c6cd726a68f1744d642324f26e8 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180423093610epcas4p2248cf6f0e76bd3e81ff6fa0ef55f5c25 X-RootMTR: 20180423093610epcas4p2248cf6f0e76bd3e81ff6fa0ef55f5c25 References: <20180422204849.GA30387@prometheus.u-strasbg.fr> On Mon, 23 Apr 2018 11:24:12 +0200 Marc Chantreux wrote: > a) can someone tell me why isn't the "alternative" syntax more used ? > > i felt in love with zsh about 20 years now and one of the reason is > the alternative syntax. so can someone explain to me why the "old" > one seems to be prefered even nowdays ? > > for x in {1..20}; do > print "$x * 2 = $[x * 2]" > done > > seems terrible to me compared to > > for x ({1..20}) print "$x * 2 = $[x * 2]" I don't really know how widely it's used, but you get a certain amount using short loops without having to remember novel syntax. for x in {1..20}; print "$x * 2 = $[x * 2]" All you need to note here is there's no "do" / "done", which I can manage. Parentheses are already rather overloaded so I don't do anything myself that adds yet more. It's quite hard to ensure alternative syntax gets parsed consistently --- I'm sure there are lots of inconsistencies --- but a lot of that is hidden. > b) why the while loop can't take (( )) or single instruction as do > list ? Maybe because it's missing the code at the bottom? As this makes something which was a parse error into something which isn't I don't think this can break anything. It's certainly not a compatibility problem because this is what SHORT_LOOPS takes care of. So I suppose it's just an oversight --- perhaps it didn't seem so obviously useful because the simple command at the end would need some exit condition for the while loop as well as doing it's basic function. > c) it seems the (+) syntax can't be used outside file expansions > (or did i miss something?) Yes, there's no general "execute a function that does something" in other cases because there's no obvious definition of whit it would do --- unlike globbing qualifiers which are there as a simple filter. > d) is there a plan to have something like namespaces ? It was first discussed a long time ago, but no one has bitten the bullet. Simple minded namespaces --- allow dots in the variable works --- are trivial, but the variable code is very complicated and working out how to do it properly is a big task that no one has been prepared to look at (saying "someone else ought to do this" does not count as looking at it" :-)). pws diff --git a/Src/parse.c b/Src/parse.c index 47e5a24..83383f1 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -1510,8 +1510,10 @@ par_while(int *cmplx) if (tok != ZEND) YYERRORV(oecused); zshlex(); - } else + } else if (unset(SHORTLOOPS)) { YYERRORV(oecused); + } else + par_save_list1(cmplx); ecbuf[p] = WCB_WHILE(type, ecused - 1 - p); }