From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 80b3288c for ; Sun, 16 Dec 2018 12:03:05 +0000 (UTC) Received: (qmail 11426 invoked by alias); 16 Dec 2018 12:02:45 -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: List-Unsubscribe: X-Seq: 43899 Received: (qmail 4771 invoked by uid 1010); 16 Dec 2018 12:02:45 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25112. spamassassin: 3.4.2. Clear:RC:0(66.111.4.25):SA:0(-2.6/5.0):. Processed in 5.707595 secs); 16 Dec 2018 12:02:45 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to; s=fm2; bh=p1w IpxbsImhYqojCSllpaNBGBUx7c7pno65aPF+ouDs=; b=Jgw4t+vvD4FMwRhGzEh 7/k3lixvtprZnpZqkbQGVNU2bTj1PUUw/Te2km1pIMj97dCUK8n4SK9aeGywtTPC lNui19kbOFk7vOtR7MkYmJeANx++zOe36K98okYrrIxNz+hbOZ3SiUiY6eF4kwWM YjgvyueGi+90G5JLXcBaRKP4bAsXNbz4nrCjxUIFgnmhVCKKbYIWc/udkoXOcT8W Nw3cT1wrKpEdKaX4TeL/d6LAS+ghb0rI87juxIk8Sc7mY8ZpHIKjONvmTAL7J4ox VPrEB251Zyjh1YnUeoKTfL35jDqvc6rvEVLwfy/uJUbiOOx4zNYoA80e3UxXJFxl 9WA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=p1wIpx bsImhYqojCSllpaNBGBUx7c7pno65aPF+ouDs=; b=RVD954Jrjftp4qPIAy2CBX ZYkk3YssIkm3FHmf4wf7jQ7kSaeRHmvJ7ypLTsScdmO8Slb3aZz44BVBf4JujhS8 zw0jIDxjnRKxf1q5tFyE41L8IXfCVjaCz44VMMMCPi//j90xISZcTwkUQk0QA6hO jBT+6DDYOc6IEOFocCXO9AfIRzYbJbjyzHnco6+QK2IkmsVsZrKWtvw8CuZuxFgb Q8Jo5HVAmLSB1RV0yc5vhHSd/7+Z8u95Fx6ucuflkXXwjkXf3sPk93/gZJ0OjnqX vLJIY/0SQ4pa8oqNi2/Vjs66rxa4DfGtloyyaDopM7YY933da1LHP72uPLzBYYOQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudehledgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeffhffvuffkfh ggtggujggfsehttddttddtredvnecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceo ugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvqeenucfkphepjeelrddukedtrd duudehrdduheehnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdr shhhrghhrghfrdhnrghmvgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Date: Sun, 16 Dec 2018 11:54:08 +0000 From: Daniel Shahaf To: Joey Pabalinas Cc: Zsh Workers Mailing List Subject: Re: [PATCH] zshmisc(1): document implicit append of `term` when `in word` is omitted Message-ID: <20181216115408.2bkygixkx7eymqvp@tarpaulin.shahaf.local2> References: <8afdae3ebc75741d47d657f29fb7d2876f9536b2.1544905398.git.joeypabalinas@gmail.com> <1544925190.621790.1610325216.065C6F48@webmail.messagingengine.com> <20181216020127.bdskejrh2ckxrg5n@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181216020127.bdskejrh2ckxrg5n@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) Joey Pabalinas wrote on Sat, Dec 15, 2018 at 16:01:27 -1000: > On Sun, Dec 16, 2018 at 01:53:10AM +0000, Daniel Shahaf wrote: > > Joey Pabalinas wrote on Sat, 15 Dec 2018 10:26 -1000: > > > This is fairly innocuous behavior and is POSIX-compliant, so document > > > this odd edge case rather than risk regressions attempting to change > > > the lexer/parser code. > > > > If preventing regressions is your goal, why not add a regression test using this syntax? > > Sorry, maybe my commit message was a bit unclear. I meant instead of > trying to poke at the parser/lexer code to make the behavior match the > documentation, I figured it's easier to just do it the other way and > document the weird edge case. > > Sorry for the ambiguity (and the double send, forgot to CC the list), The double send is my fault, not yours. It is I who replied off-list in the first place. > should I revise the commit description? Let me begin by saying I'm not familiar enough with the parser to have an opinion on whether it would be better to have change the docs to match the code, or change the code to match the docs, or leave this as an implementation detail that's subject to change. All that said, I'm not too bothered by the grammar of the log message (which is now explained in this thread anyway). I'd sooner suggest changes to the new text: > +++ b/Doc/Zsh/grammar.yo > @@ -185,11 +185,12 @@ cindex(loops, for) > item(tt(for) var(name) ... [ tt(in) var(word) ... ] var(term) tt(do) var(list) tt(done))( > where var(term) is at least one newline or tt(;). > Expand the list of var(word)s, and set the parameter > var(name) to each of them in turn, executing > var(list) each time. If the tt(in) var(word) is omitted, > -use the positional parameters instead of the var(word)s. > +use the positional parameters with a var(term) implicitly > +appended instead of the var(word)s. > Two issues here: 1. The docs of var(term) are spread across the first and last sentence. 2. Adding a side remark about var(term) to the last sentence may obscure that sentence's primary point about the fallback to positional parameters. So, perhaps something like this (relative to master): -where var(term) is at least one newline or tt(;). Expand the list of var(word)s, and set the parameter var(name) to each of them in turn, executing -var(list) each time. If the tt(in) var(word) is omitted, +var(list) each time. If the `tt(in) var(word)' is omitted, use the positional parameters instead of the var(word)s. + +var(term) should be one or more newline or tt(;), and is optional if +the `tt(in) var(word)' is omitted. But let's wait for someone familiar with the parser to opine on the proposed strategic direction ("document the parser's behaviour") before we spend too much time on implementing that. > More than one parameter var(name) can appear before the list of > var(word)s. If var(N) var(name)s are given, then on each execution of the > loop the next var(N) var(word)s are assigned to the corresponding > parameters. If there are more var(name)s than remaining var(word)s, the Cheers, Daniel