On 12/06/2015 11:58, Ulrike Fischer wrote:
> Am Fri, 12 Jun 2015 10:50:34 +0100 schrieb Joseph Wright:
>
>
>>> Why is the T-branch executed in the second case? Is is a bug?
>
>> Yes:
>
> That's a relieve. I was really very bewildered ;-)
Glad I could help: is a release urgent?
> Btw: I came across the problem because I was looking for a way to
> get
>
> \keys_set:nn { test } {type=\testvalue}
>
> working, if \testvalue expands to a known choice. Is there some good
> way to do it?
>
> \exp_args:Nnx\keys_set:nn { test } {type=\testvalue}
>
> works but could lead to problems if more keys are in the list.
Like other keyval systems, l3keys does no expansion of the key or value
when parsing: that's by-design. As such, you are going to have to go
with x-type expansion here if you want the effect you describe. If the
input might contain uncontrolled LaTeX2e user input then you'll have to
go with \protected@edef and an intermediate tl, but if everything can be
assumed to be LaTeX3-based (or if you make it clear that \robustify or
similar should be applied to any non-robust input) then define a variant
and use \keys_set:nx.
---
Joseph Wright