Received: from mx0.gmx.net (mx0.gmx.net [213.165.64.100]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with SMTP id p9E7uqc9027934 for ; Fri, 14 Oct 2011 09:56:53 +0200 Received: (qmail 7211 invoked by alias); 14 Oct 2011 07:56:47 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 14 Oct 2011 07:56:46 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx029) with SMTP; 14 Oct 2011 09:56:46 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id p9E7rodq003310 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 14 Oct 2011 09:53:50 +0200 Received: from listserv.uni-heidelberg.de (localhost.localdomain [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id p9E7Fwf1025032; Fri, 14 Oct 2011 09:53:49 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 1796173 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 14 Oct 2011 09:53:49 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id p9E7rnk6010384 for ; Fri, 14 Oct 2011 09:53:49 +0200 Received: from ueamailgate02.uea.ac.uk (ueamailgate02.uea.ac.uk [139.222.131.185]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id p9E7rVcJ003198 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 14 Oct 2011 09:53:36 +0200 Received: from ueams01.uea.ac.uk (ueams01.uea.ac.uk [139.222.131.78]) by ueamailgate02.uea.ac.uk (8.13.8/8.13.8) with ESMTP id p9E7rV1G025334 for ; Fri, 14 Oct 2011 08:53:31 +0100 Received: from [139.222.114.31] by ueams01.uea.ac.uk with esmtp (Exim 4.69) (envelope-from ) id 1REcX4-0008Ks-Bl for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 14 Oct 2011 08:50:18 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 References: <4E95A9C2.6020607@residenset.net> <4E95C086.7060806@morningstar2.co.uk> <4E96F7BF.9070700@residenset.net> X-Enigmail-Version: 1.3.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN, outgoing) X-CanIt-Geo: ip=139.222.131.78; country=GB; region=I9; city=Norwich; latitude=52.6333; longitude=1.3000; http://maps.google.com/maps?q=52.6333,1.3000&z=6 X-CanItPRO-Stream: UEA:outgoing (inherits from UEA:default,base:default) X-Canit-Stats-ID: 06FIvRvvX - 0f1a90fcb19d - 20111014 X-Scanned-By: CanIt (www . roaringpenguin . com) on 139.222.131.185 Message-ID: <4E97EA81.6040504@morningstar2.co.uk> Date: Fri, 14 Oct 2011 08:53:37 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: Church booleans To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Sender is in whitelist: joseph.wright@MORNINGSTAR2.CO.UK); Detail=5D7Q89H36p4L00VTXC6D4q0N+AH0PUCnBi0P5cROEGjO+pG7NAH/K+tf9SrVFtpLrKONl 2T9EL4W4U4jgzLbnCcGpk1z/zwmKT/K1fv3lD0=V1; X-Resent-By: Forwarder X-Resent-For: rainer.schoepf@gmx.net X-Resent-To: rainer@rainer-schoepf.de Status: R X-Status: X-Keywords: X-UID: 6942 On 13/10/2011 19:23, Bruno Le Floch wrote: > (1) Precedence: > - Currently "a&&b||c" means "a&&(b||c)" and "a||b&&c" means "a||(b&&c)". > - Other programming languages decide that either && or || has higher > precedence. Is there an accepted consensus on which one should bound > tighter? As other comment, the usual order is NOT > AND > OR (not sure about XOR). > (2) Using & is awkward. Currently we use "&&" and "||". We could use > "and" and "or" (and add things like "xor"), with precisely the same > parsing mechanism, avoiding issues within alignments entirely. It is > also rather cheap to provide "AND" and "OR", or ".and." and ".or.", or > whatever else we wish. We just have to decide which one is good (or > provide several). Remember that any change here is going to need a *good* reason: change 'for the sake of it' is not what is needed. Now, I've worried before about using "&", and there are performance arguments for the suggested Church-type booleans, so there is a case for change. I note that etoolbox goes with the simple "and", "not" and "or", and to me this seems like a sensible approach. If that is done, there would need to be transitional support for the current syntax, of course. >> Along that line of though, I've also toyed with the idea of having an xparse >> o argument return either >> >> \NoValue or >> \YesValue{} >> >> where >> >> \cs_new:Npn \NoValue {-NoValue-} >> \cs_new_eq:NN \YesValue \use_i:n >> \cs_new:Npn \IfNoValueTF #1 { \use_iii:nnn #1 \use_iii:nnn \use_i:nn } >> >> It's not quite as elegant as the Church booleans, but strikingly simple. > > And much faster, indeed, than \pdfstrcmp. This would usually get my > vote. However, xparse is at the user level, so a few micro-seconds > gained here and there (that's what \benchmark:n is giving me) are not > going to make any sizeable difference. Also, I find giving the > arguments as "\YesValue{}" to the user quite awkward. Not keen. The \IfNoValue test is supposed to be implemented in exactly the same way as any other conditional, which the above certainly is not. Moreover, the above is adding a token (and I guess braces) to the input. There is no requirement to use a NoValue test with an optional argument, and the above would therefore mess up any 'direct' use of the input unless it's being expanded first. You then need to remember that part of the defined semantics of \NoValue is that its protected, so it's not clear what should happen about protection for \YesValue. As Bruno comments, performance at the user end is not critical. I'm not sure that this change really offers a benefit which justifies some potentially-risky alterations. -- Joseph Wright