From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17263 invoked by alias); 2 Mar 2015 10:32:06 -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: X-Seq: 19951 Received: (qmail 842 invoked from network); 2 Mar 2015 10:32:03 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_PCNT autolearn=no version=3.3.2 Date: Mon, 2 Mar 2015 11:31:56 +0100 From: Vincent Lefevre To: zsh-users@zsh.org Subject: Re: grammar triviality with '&&' Message-ID: <20150302103156.GB6869@xvii.vinc17.org> Mail-Followup-To: zsh-users@zsh.org References: <54F33934.2070607@eastlink.ca> <13666281425228233@web7o.yandex.ru> <54F345D3.9010204@eastlink.ca> <20150302022754.GA7449@xvii.vinc17.org> <150302005440.ZM16546@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <150302005440.ZM16546@torch.brasslantern.com> X-Mailer-Info: http://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.23-6424-vl-r76280 (2015-02-19) On 2015-03-02 00:54:40 -0800, Bart Schaefer wrote: > On Mar 2, 3:27am, Vincent Lefevre wrote: > } > } However "&& [ -e file2 ]" could constitute a list too. There is > } currently a parse error, but zsh could have an extension to accept > } it as being equivalent to: "[[ $? -eq 0 ]] && [ -e file2 ]". Would > } there be anything wrong with such an extension? > > If nothing else, the errexit option would fail. With errexit, > > false > || anything > > would never get beyond "false", whereas > > false || anything > > proceeds at least through "anything". I agree that's not equivalent, but this would not be a problem in a "if ... then" construct (though I think it's a bad idea to use such a feature here). > You also get strange crap like > > while && this; do || if && that; then || thus; fi; done > > which would mean what, exactly? while [[ $? -eq 0 ]] && this; do [[ $? -ne 0 ]] || if [[ $? -eq 0 ]] && that; then [[ $? -ne 0 ]] || thus; fi; done > Finally if it's OK to have nothing before && / ||, then it would also be > syntactically OK to write > > && || && || && && ... I disagree. Only a && or || as the first word of a list would have a special meaning. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)