## LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

 Options: Use Classic View Use Proportional Font Show Text Part by Default Show All Mail Headers Topic: [<< First] [< Prev] [Next >] [Last >>]

 Re: Should l3keys provide a key .initial:n? Bruno Le Floch <[log in to unmask]> Sun, 27 May 2012 00:06:13 +0200 text/plain (69 lines) On 5/26/12, Joseph Wright <[log in to unmask]> wrote: > On 26/05/2012 16:12, Marco Daniel wrote: >> Hello, >> >> Today I noticed that there is no key .initial:n. This question popped up >> during writing a small package. Whatever at the moment you have the >> following possibilities to set a key-value-syntax with an initial value: >> ======================================================================= >> %First approach: >> >> \keys_define:nn { module } >> { >> myoption .int_set:N = \l_modul_myoption_int >> } >> \keys_set:nn { module } >> { >> myoption = 2 >> } >> \ProcessKeysOptions { module } >> >> ======================================================================= >> Second approach >> >> \keys_define:nn { module } >> { >> myoption .int_set:N = \l_modul_myoption_int , >> myoption .default:n = 2 >> } >> \keys_set:nn { module } { myoption } >> \ProcessKeysOptions { module } >> >> ======================================================================= > > Note that this are not equivalent when you consider the behaviour later > on. In the second case, giving "myoption" is the same as "myoption = 2", > but in the first case the two are distinct. > >> I suggest to define a new key .initial:n so that we have a third >> approach: >> >> Second approach >> >> \keys_define:nn { module } >> { >> myoption .int_set:N = \l_modul_myoption_int , >> myoption .initial:n = 2 >> } >> \ProcessKeysOptions { module } >> >> ======================================================================= > > At one point we did have this. Checking back through the archive, I > removed it as it did not seem to add anything to the two-stage process. > However, that was not a 'strong' objection: I was simply trying to keep > the number of properties down as far as possible. If this looks like a > useful addition I've no problem adding it back in: anyone else have a view? > -- > Joseph Wright > I'm no keys expert, but couldn't   \int_set:Nn \l_modul_myoption_int { 2 } do the job, at least in this case? Cheers, Bruno