Sender: |
|
Date: |
Fri, 17 Jul 2015 13:25:17 +0200 |
Content-Disposition: |
inline |
Reply-To: |
|
Subject: |
|
MIME-Version: |
1.0 |
Message-ID: |
|
In-Reply-To: |
|
Content-Type: |
text/plain; charset=iso-8859-15 |
From: |
|
Parts/Attachments: |
|
|
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-macro>
> && \some_test:N <some-macro>
> }
>
>won't work if the second test only works if <some-macro> 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
|
|
|