Sender: |
|
Date: |
Mon, 20 Jul 2015 04:40:46 +0000 |
Reply-To: |
|
Subject: |
|
MIME-Version: |
1.0 |
Message-ID: |
|
In-Reply-To: |
|
Content-Type: |
multipart/alternative; boundary=001a113a6f64afcfc7051b47249f |
From: |
|
Parts/Attachments: |
|
|
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 <[log in to unmask]> 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 <
> [log in to unmask]> 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
>>
>
|
|
|