Difference between the V function parameter specifier and the o specifier in LaTeX3 programming

expl3latex3programming

In LaTeX3 programming, how does the V function parameter specifier differ from the o specifier? How is the o specifier meant to be used in contrast to the V specifier?


A related question: V vs. x

Best Answer

The o-specifier is 'lower-level' and does exactly one expansion of the argument: \foo:o {...} is equivalent to \expandafter \foo:n \expandafter {...}. In contrast, V-type expansion provides the value of a variable, which may be either a tl/clist (stored as a macro) or an int/dim/skip (stored as a register). To deal with the latter, V-type expansion inserts the required \the to yield the value. Thus o-type expansion is only equivalent to V-type where you know that the value to expand is a macro. One may use o-type expansion for cases where V-type does not apply, e.g.

\foo:n { \use_none:n <some tokens> }

Notice that the o-type takes a balanced text argument (zero or more tokens in braces), whereas the V-type takes a single token. This is quite different in semantics.

Related Question