Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by h1439878.stratoserver.net (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id t6HBVR3I009619 for ; Fri, 17 Jul 2015 13:31:28 +0200 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx011) with ESMTPS (Nemesis) id 0LuLId-1YrL7G1ynX-011kY4 for ; Fri, 17 Jul 2015 13:31:21 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t6HBTwOn010944 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 17 Jul 2015 13:30:01 +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 t6HBO21U026869; Fri, 17 Jul 2015 13:29:57 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 12364617 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 17 Jul 2015 13:25:42 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t6HBPfmT030303 for ; Fri, 17 Jul 2015 13:25:41 +0200 Received: from mxout.hzdr.de (ix1.fz-rossendorf.de [149.220.4.85]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id t6HBParJ013840 for ; Fri, 17 Jul 2015 13:25:38 +0200 Received: from fz-rossendorf.de (cg.hzdr.de [149.220.4.64]) by mxout.hzdr.de (Postfix) with ESMTP id 62DCFBC9C for ; Fri, 17 Jul 2015 13:25:36 +0200 (CEST) Received: from [149.220.65.84] (HELO fwo045.hzdr.de) by hzdr.de (CommuniGate Pro SMTP 6.1.4) with ESMTP id 10765117 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 17 Jul 2015 13:25:32 +0200 Received: by fwo045.hzdr.de (Postfix, from userid 1530) id 6F545E86CD; Fri, 17 Jul 2015 13:25:17 +0200 (CEST) References: <55A8C0C2.3040908@morningstar2.co.uk> <20150717095912.GA6487@hzdr.de> <55A8E267.1030901@morningstar2.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Message-ID: <20150717112517.GB6487@hzdr.de> Date: Fri, 17 Jul 2015 13:25:17 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Alexander Grahn Subject: Re: expl3 boolean expressions: lazy evaluation To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <55A8E267.1030901@morningstar2.co.uk> 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:pkjr53tyPUg=:38e/rMMCHPwu532NNmTJZG9A+Q M7O4LNr7mf8QM5nlExvf+r6UpQVFVcFiNPKPOkFTkPMI9MMzgJXtxSKRcGvvJ6rIr/o1Ajy3Q gkosbevmB4KC1q/JiMT39MkOi/RvFDMuIyHIAB+YNJl7Er39/og4ZJ+Mu3SVOwKBz9eKsTT3U b9GfZNtrQntz1NcXhNQtLIytry8OgU3zGa0xyQluDXDQZm4I3D2I1ZjWA2ctxrZ769QjTgSra b+J56ZDS+KQvzFhN/IUaOn+ZxISg952M1TDuvLrZ3xSrZIrmty2MIKA9uvpKKB+kvr+UKWwsW nD6UerZj8zlW64R62XtM9D+v5dYQxajYVUPXFqgdYF6cmk6UnSxkylQxzBUB3XniSNGu9Dscy KFrdY9fNfyhhVCS6o2btHXyBE3m12Q3aIGb1JSl+fuI1Ot1ykv0/+dlPJ9srqD+3nt5igaHry AUJG0YFAEt0/sa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RdBqti+bJDzazqGJGEQiyZjAfr7QgElL6w= X-UI-Out-Filterresults: notjunk:1;V01:K0:UeRIH9sGyd0=:vc1lGkGyOR32LYBjbs/GOS 6Ll1WJAJoaLx13DSDVNpftAKnRpNwVSIfAwuo65XJzz2L36eMSOp58x+7rRefpLXbC7280bns OOC9chNtH//OoS0q8Ox9vhw9eucLMYg2X7bXFXUMfLg4DvYH9TaJ2oQ/i+IOh4G1ZhHHEnd5l IpgyyTvY4oXY50Dk/MSwNhh5bhvJ6w1Z63pc8/8i34VGKN6iWNOhv7VP4WqcsK9nltze6ZG0D udBq6wrvW4JnHmdoIQZCFFYDfHF/CyIK8d33tSVYjIMNXahkHQN8vMjfYegdBzRHQ7meDAJ9I 686W7TbwoJ3StqLaq8ioC/xKsSnWZrXKa4b5MrdJAyxBZttQtkL89ZXuVN4niQIfhfRcHtMFU OkK0Vi1iTj8u34VQU/IovV33G38yERLsxtFogfFy9sEkM5bChwwyFOPzmgkIJI6gnemqtU//Y Cf2Yli78tKeQ5+TjC3NzAEq5dWRxs+O6aVpYa+tM4CZ6bTANB/Q2 X-Scanned-By: MIMEDefang 2.71 on 85.214.41.38 Status: R X-Status: X-Keywords: X-UID: 7791 Joseph, On Fri, Jul 17, 2015 at 12:09:27PM +0100, Joseph Wright wrote: >On 17/07/2015 10:59, Alexander Grahn wrote: >>> \bool_if:nTF >>> { >>> \cs_if_exist_p:N \pdftex_pdfoutput:D >>> && \int_compare_p:nNn \pdftex_pdfoutput:D > \c_zero >>> } >>> { pdfmode } >>> { dvips } >>> >>> will fail as the second test will not be skipped. We note though that >>> this case is likely unusual: in general expl3 variables should be >>> declared before use so should. A quick sweep over TL2015 shows the >>> following packages would have to be updated following any change: >>> >>> - media9 >>> -ocgx2 >>> >>> (Other packages do use \cs_if_exist_p:(N|c) but not in a way which >>> relies on lazy evaluation.) >>> >>> Are there other obvious issues if we switch from lazy evaluation? If the >>> change is to be made we intend to work with package authors in advance >>> to make sure that users are not impacted. >> >> thank you for pointing out this. Could you please give me specific >> advice on the changes I will have to do? >> >> Kind regards, >> Alexander > >Hi Alexander, > >As I said, at present we've not changed anything precisely because we >are not sure whether dropping lazy evaluation is acceptable. (It's a >tricky balance: having an issue with ")" tokens is also not ideal.) The >reason I've raised on LaTeX-L is we want to be sure the proposed change >doesn't cause significant issues either for end-users or for programmers. > >Assuming we do make a change and evaluate all parts of an expression >then doing > > \bool_if:nT > { > \cs_if_exist_p:N > && \some_test:N > } > >won't work if the second test only works if is defined. In >your code you've got three places I can see where \cs_if_exist_p:N or >\cs_if_exist_p:c is used as the first test in an expression, so the >second one will fail. The options are then to rewrite as a set of nested >TF versions > > \cs_if_exist:NTF \foo > { } > { } > >or to use a bit of imagination to avoid that. Assuming the latter is >wanted, in media9 you could replace > > \bool_if:nTF > { > !\cs_if_exist_p:c {#1} > || !\str_if_eq_x_p:nn {\tl_use:c{#1} } {#2} > } > >by > > \bool_if:nTF > { > !\cs_if_exist:cTF {#1} > { > \str_if_eq_x_p:nn { \tl_use:c {#1} } {#2} > } > { \c_false_bool } > } > >and replace > > \bool_if:nT > { > \cs_if_exist_p:N \fxocg@insert@OC > && !\tl_if_blank_p:V \fxocg@insert@OC > } > >by > > \bool_if:nT > { > ! \cs_if_exist:NTF \fxocg@insert@OC > { \tl_if_blank_p:V \fxocg@insert@OC } > { \c_true_bool } > } > >In ocgx2.sty there is > > \bool_if:nT > { > !\cs_if_exist_p:c { OCGpdfobj#3 } > || !\str_if_eq_x_p:nn { \use:c { OCGpdfobj#3 } } { \use:c { >ocgxii@#3 } } > } > >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 } > { > \str_if_eq_x_p:nn { \use:c { OCGpdfobj#3 } } { \use:c { >ocgxii@#3 } } > } > { \c_false_bool } > } > >(BTW, I assume ocgxii@#3 is known to be defined!) > >I hope this makes sense. >-- >Joseph Wright > Thank you for the detailed instructions! I will keep a copy of this message in case the suggested changes become necessary. Alexander