When working with a LaTeX3 variable of type token list, it is possible to declare a new variable, and later to set its value:
\tl_new:N \g_my_tl
...
\tl_set:Nn \g_my_tl {tokens}
The same template can be used with LaTeX3 variables of type string, sequence, and integer.
Is there a way to use the same or similar template with LaTeX variables of type control-sequence? I'd like to separate the declaration of a control-sequence variable from the act of setting its value. It's OK if the declaration of the control-sequence also sets its value to 'undefined'.
To give an example of usage, suppose I wish to write a LaTeX3 function \f:NNN
, which takes three parameters: an integer variable, a control-sequence variable, and a token-list variable. I wish to give these parameters descriptive names. For this purpose I'd like to start my function by declaring variables of type integer, control-sequence, and token-list, and then to initialize them, as follows.
\cs_new:Npn \f:NNN #1#2#3
{
\int_zero_new:N \l_int
\cs_clear_new:N \cs_myfunc_l:
\tl_clear_new:N \l_tl
\int_set:NN \l_int #1
\cs_set:NN \cs_myfunc_l: #2
\tl_set:NN \l_tl #3
...
% Now I can use the variables' names rather than #1, #2, and #3.
...
}