More optional \xx_use:N and \xx_new:N functions than documented?

Using just \l_siemer_foo_tl or \l_siemer_foo_str instead of

\tl_use:N \l_siemer_foo_tl
\str_use:N \l_siemer_foo_str

is indeed allowed, but not really recommended. I generally try to prefix with \tl_use:N (or \str_use:N because it's cleaner programming, unless conciseness makes the “unprefixed” way preferable. Note that \tl_use:N requires a few expansion steps, whereas the unprefixed form only requires one and this can make a difference in an already long program.

On the other hand, \tl_use:N also checks whether the following variable is declared, when the check-declarations option is in force.

There are other <module>_use:N functions, namely \dim_use:N, \skip_use:N, \muskip_use:N, \int_use:N, \box_use:N and \fp_use:N; omitting these will lead to disasters.

Using any variable (except tl or str, as mentioned) in the wild will do nothing good; in some cases you get a sensible error, such as A sequence was misused. or A floating point with value '1.2' was misused. In other cases (think to dim variables) you'd get a very low level error message or unexpected output.

The only other variable type that could be used in the wild is clist, but this is just for reasons of implementation and this feature should not be relied upon. Thus \l_siemer_foo_clist should not be considered as a shorthand for \clist_use:Nn \l_siemer_foo_clist {,} (which I don't really see a use for anyway). Your nice program using it might no longer work because the internal implementation of clist variables has changed.

For other variable types there is no <module>_use:N function, but other arguments are needed that exploit the variable's internal structure.

And, no, <module>_new:N is definitely not optional, for any variable type.


Any variable type that is ultimately a macro can be 'used' without an accessor. However, that might lead to surprising results: for example, take a look at the raw structure of an fp!

The official position on declaration of variables will not change: they have to be declared before use. The one exception is where they are 'auto-created' by l3keys: a compromise to avoid extremely repetitive code.

Tags:

Latex3

Expl3