Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by h1439878.stratoserver.net (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id t6K4r19v020450 for ; Mon, 20 Jul 2015 06:53:02 +0200 Received: from relay.uni-heidelberg.de ([129.206.100.212]) by mx-ha.gmx.net (mxgmx004) with ESMTPS (Nemesis) id 0LfHGC-1YbKOd2b4y-00ojqn for ; Mon, 20 Jul 2015 06:52:55 +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 t6K4p29S014438 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Jul 2015 06:51:03 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t6K28YkA015955; Mon, 20 Jul 2015 06:51:02 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 12365226 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 20 Jul 2015 06:51:02 +0200 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t6K4f2Fm025528 for ; Mon, 20 Jul 2015 06:41:02 +0200 Received: from mail-yk0-f169.google.com (mail-yk0-f169.google.com [209.85.160.169]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t6K4eucf017698 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Mon, 20 Jul 2015 06:40:59 +0200 Received: by ykax123 with SMTP id x123so131103220yka.1 for ; Sun, 19 Jul 2015 21:40:55 -0700 (PDT) X-Received: by 10.170.149.68 with SMTP id q65mr26657569ykc.33.1437367255681; Sun, 19 Jul 2015 21:40:55 -0700 (PDT) MIME-Version: 1.0 References: <55A8C0C2.3040908@morningstar2.co.uk> <20150717095912.GA6487@hzdr.de> <55A8E267.1030901@morningstar2.co.uk> <20150717140025.GA10619@hzdr.de> <55A90BC0.6020102@morningstar2.co.uk> Content-Type: multipart/alternative; boundary=001a113a6f64afcfc7051b47249f Message-ID: Date: Mon, 20 Jul 2015 04:40:46 +0000 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Sean Allred Subject: Re: expl3 boolean expressions: lazy evaluation To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-GMX-Antivirus: 0 (no virus found) X-UI-Filterresults: notjunk:1;V01:K0:9FcdA1XRoz0=:dJyQ73HZA1n9lOci9GrdrajCRJ guG9u/uh3t2lMFh4CjjmzTxRG7H5TU/ETGufxwSgmYw5sWj8KWX05EnZPuAA4710C2cVPVL1L DdVwxulFPRFcoyXeoHp/PCbtHOL3/RbotVu+9A9JDTwJyKCiGDn5tplTtP3p7qLtaeu4DkZhi 5bXEaEz1PheYP/PsiQzoYM2zatkSY6ukbvJt00TuSq9edQtUaN2sJEwHSaQ7UtZXA6kqchj9f ieXUaNP07bGRRsVt8XsOyHN0py6T3dzSpPrOBp7W7UNl4OOtUfdAnOeR6O3lNZyRwGub9A7BZ ewKkpQhC0luJaeKWdivEvRcEPrf9BFB3PKeMi77LOvL4l0sb9vCnB3pDU4fBcjmFGgQrKHqsZ GEUEwzhXLCiOXhsqGxBMT+LfpWda1ZCLcf5b8BdV4pK101t68qgz1qMz+ge6oeTLYDBA99Gvd SI8JzpJEDwMXPbWsVmqs7BOVbmQzCPG0KZNsVVgYsxEKHFjgDBXIzlB/HbZzU6QwK0+dAw0by dGdfUCfiJkjMdJ3hh4+MfrtwKhd+N88oHuLK08tnv1fvudzIZ1SRBeK5AvP57aosIFb6TVIGz tYeBB9ghiWoqcMHN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bQLh6vPn8KbmI/7FzSp3uclxSr+QXsa3muHggoFDpG G+RNILusKwbuvGwyoIZs2caPBhZQTVTbpJMCjrRzCnOxm+xnpyoRsdYWGhtMoaAKIUPOP59sZ aKbdcZ7xOShatO1H3GV+tbbdcWFu88zh4fGl7jb7dNO3oDRJctxKwrViV80Az4zp1DwDdwGsF Wwc7ISIkrhFSvS4+uxfqSqEdq/Rl5/kACI2kqv4LT5AwCoqwFNn1G0Nq93vsPq1i6Hd1qGmrG Rnp6vxORIkhBhQQcEs6uuzSiF7grRsYhzYXVA79HIK+kB++4m6JynFFUFiu5Qlz1mIjg1OcfG 5PBsGyMnFeAp+oYgBrNHU/z7r5Z3hpxJYZ1512AbG8ej0/S0wLK6cek7o1ijBL+BOHd+19wuK 5ATOKxXbqhRBPt5NdUIt75+78uIooVOxZnySZQjpNU0cGK8er6bT X-Scanned-By: MIMEDefang 2.71 on 85.214.41.38 Status: R X-Status: X-Keywords: X-UID: 7802 --001a113a6f64afcfc7051b47249f Content-Type: text/plain; charset=UTF-8 Hi all, If I might add my two cents: I don't believe it's out of the question to wrap macro-parameters in some sort of \bool_validate:n (if such a thing doesn't already exist) that would run the checks and issue appropriate errors on a case-by-case basis. I believe it's important to assume the programmer knows what he or she is doing and let them account for this themselves. Otherwise, you introduce complexity where none is needed for a large portion of folks. Not to mention that it is just that much more to test and maintain. -- Sean Allred On Sun, Jul 19, 2015 at 11:30 PM Sean Allred wrote: > Hi all, > > If I might add my two cents: > > I don't believe it's out of the question to wrap macro-parameters in some > sort of \bool_validate:n that would run the checks and issue appropriate > errors on an on-demand basis. Assume the programmer knows what he or she is > doing and let the programmer account for this on a case-by-case basis. > > -Sean Allred > > On Fri, Jul 17, 2015 at 9:07 AM Joseph Wright < > joseph.wright@morningstar2.co.uk> wrote: > >> On 17/07/2015 15:00, Alexander Grahn wrote: >> > Joseph, >> > >> > On Fri, Jul 17, 2015 at 12:09:27PM +0100, Joseph Wright wrote: >> >> by >> >> >> >> \bool_if:nTF >> >> { >> >> !\cs_if_exist:cTF {#1} >> > really an `!' in front? >> > >> >> by >> >> >> >> \bool_if:nT >> >> { >> >> ! \cs_if_exist:NTF \fxocg@insert@OC >> > same here. >> > >> >> which could be redone as for the first case in media9. However, >> >> reviewing the code I realise that as you have \use:c here you'll >> >> actually get away with it (the second part will evaluate even if the >> >> csname is undefined). If you do want a 'safe' change then >> >> >> >> \bool_if:nTF >> >> { >> >> ! \cs_if_exist:cTF { OCGpdfobj#3 } >> > same here. >> > >> > Alexander >> >> Indeed :-) >> >> I've tried to offer a 'minimal change' version of your code. To do that, >> I've using the fact that \bool_if:nTF works by expansion. So >> >> \bool_if:nTF >> { >> !\cs_if_exist:cTF {#1} >> ... >> } >> >> will find the "!" then expand what follows looking ultimately for >> \c_true_bool or \c_false_bool. In the usual set up with something like >> \cs_if_exist_p:c we have a function that will expand to one of these >> outcomes. With \cs_if_exist:cTF that's not automatically the case but we >> can put the logical outcomes into the T/F branches (as I did) to force >> the same result. >> -- >> Joseph Wright >> > --001a113a6f64afcfc7051b47249f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi all,

If I might add my two cents:

I don&#= 39;t believe it's out of the question to wrap macro-parameters in some = sort of \bool_validate:n (if such a thing doesn't already exist) that w= ould run the checks and issue appropriate errors on a case-by-case basis. I= believe it's important to assume the programmer knows what he or she i= s doing and let them account for this themselves. Otherwise, you introduce = complexity where none is needed for a large portion of folks.

Not to mention that it is just that much more to test and maintain.

--=C2=A0
Sean Allred

On Sun, Jul 19, 2015 at 1= 1:30 PM Sean Allred <allred.sea= n@gmail.com> wrote:
Hi = all,

If I might add my two cents:

I don't believe it'= s out of the question to wrap macro-parameters in some sort of \bool_valida= te:n that would run the checks and issue appropriate errors on an on-demand= basis. Assume the programmer knows what he or she is doing and let the pro= grammer account for this on a case-by-case basis.

-Sean = Allred

On Fri, Jul 17,= 2015 at 9:07 AM Joseph Wright <joseph.wright@morningstar2.co.uk> wrot= e:
On 17/07/2015 15:00, Alexander G= rahn wrote:
> Joseph,
>
> On Fri, Jul 17, 2015 at 12:09:27PM +0100, Joseph Wright wrote:
>> by
>>
>>=C2=A0 =C2=A0 \bool_if:nTF
>>=C2=A0 =C2=A0 =C2=A0 {
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 !\cs_if_exist:cTF {#1}
> really an `!' in front?
>
>> by
>>
>>=C2=A0 =C2=A0 \bool_if:nT
>>=C2=A0 =C2=A0 =C2=A0 {
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ! \cs_if_exist:NTF \fxocg@insert@OC
> same here.
>
>> which could be redone as for the first case in media9. However, >> reviewing the code I realise that as you have \use:c here you'= ll
>> actually get away with it (the second part will evaluate even if t= he
>> csname is undefined). If you do want a 'safe' change then<= br> >>
>>=C2=A0 =C2=A0 \bool_if:nTF
>>=C2=A0 =C2=A0 =C2=A0 {
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ! \cs_if_exist:cTF { OCGpdfobj#3 }
> same here.
>
> Alexander

Indeed :-)

I've tried to offer a 'minimal change' version of your code. To= do that,
I've using the fact that \bool_if:nTF works by expansion. So

=C2=A0 =C2=A0 \bool_if:nTF
=C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!\cs_if_exist:cTF {#1}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0...
=C2=A0 =C2=A0 =C2=A0 }

will find the "!" then expand what follows looking ultimately for=
\c_true_bool or \c_false_bool. In the usual set up with something like
\cs_if_exist_p:c we have a function that will expand to one of these
outcomes. With \cs_if_exist:cTF that's not automatically the case but w= e
can put the logical outcomes into the T/F branches (as I did) to force
the same result.
--
Joseph Wright
--001a113a6f64afcfc7051b47249f--