LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Joseph Wright <[log in to unmask]>
Thu, 11 Nov 2010 12:17:27 +0000
text/plain (36 lines)
On 11/11/2010 12:06, Rémy Oudompheng wrote:
> Another l3keys puzzle : the following code
>
> \documentclass{minimal}
> \usepackage{expl3}
> \begin{document}
> \ExplSyntaxOn
> \keys_define:nn {module} {
>    a .default:n = Alice ,
>    a .code:n = Hello #1 ,
> }
> \keys_set:nn {module} {a}
> \ExplSyntaxOff
> \end{document}
>
> produces "Hello ", but if I swap the "default:n" and "code:n" line, I
> get "Hello Alice".
>
> The example from the documentation (latex3-source.pdf) also puts the
> "default:n" line last. Is that mandatory ?

At least in the current implementation, .code:n will 'reset' any other 
properties of a key. So setting "a .code:n = Hello #1" will delete any 
default value. I guess that this needs more explanation.

Now, you might wonder why this happens. The thinking when I wrote this 
was that if you change the code in some arbitrary way then any other 
properties may no longer be valid. For example, if you do something like

   a .value_forbidden: ,
   a .code:n = Hello #1 ,

then it's not exactly obvious what should happen about 'forbidden' property.
-- 
Joseph Wright

ATOM RSS1 RSS2