Sender: |
|
Date: |
Tue, 14 Jul 2015 09:42:13 +0100 |
Reply-To: |
|
Message-ID: |
|
Subject: |
|
MIME-Version: |
1.0 |
Content-Transfer-Encoding: |
7bit |
In-Reply-To: |
|
Content-Type: |
text/plain; charset=windows-1252 |
From: |
|
Parts/Attachments: |
|
|
On 14/07/2015 09:13, Ulrike Fischer wrote:
> Am Tue, 14 Jul 2015 07:14:42 +0100 schrieb Joseph Wright:
>
>> On 03/07/2015 08:58, Ulrike Fischer wrote:
>>> - .default:X can imho be reset with .default:n= {}.
>>> - .groups:n can imho be reset with .groups:n = {}.
>>
>> As previously noted, I'll alter this behaviour for .groups:n so a blank
>> version means 'remove from grouping'. I'll also document that.
>>
>> The .default:n is different: an empty default is not the same as no
>> default at all (as a default means effectively a value is always given).
>
> In many cases it is. E.g. I could see not difference with the
> .code:n or .tl_set:N. And even choice keys works without a default:
>
> \documentclass{article}
> \usepackage{expl3}
> \begin{document}
> \ExplSyntaxOn
> \keys_define:nn {test}
> {
> testa .code:n = {the~argument~is #1!},
> testb .tl_set:N = \l_test_tl,
> testc .choice:,
> testc / .code:n={xxx},
> }
>
> \keys_set:nn {test} {testa,testb,testc}
>
> \tl_if_empty:NTF\l_test_tl{~empty}{not empty}
>
> \ExplSyntaxOff
>
> \end{document}
I was thinking of
\keys_define:nn {test}
{
testa .code:n = {\tl_show:n {#1}},
testa .value_required:,
testb .code:n = {\tl_show:n {#1}},
testb .value_required:,
testb .default:n = {}
}
\keys_set:nn {test} {testa,testb}
where one might expect to get an error only in the first case. That's
not currently the situation! Setting the value required then setting a
default is a bit odd, but the behaviour should be defined one way or
another. I can see this both ways: I can alter the code so a default
'counts' for a required value or can document that it doesn't.
> But .default:n={} wouldn't work with bool.
No. I could add a property to remove a default but I think at present
it's unusual enough that .undefine: followed by 'recreating' the key
should probably cover it.
--
Joseph Wright
|
|
|