latex3/svn-mirror — Issue #59: exp_last_unbraced with empty argument
Author: blefloch
Created: 2011-12-05 00:50:31+00:00
State: open
Labels: expl3

What should `\exp_last_unbraced:No \show { } \c_space_tl` show? In an ideal world, it should expand the empty argument once, giving back an empty argument, then leave this expanded argument in from of `\show` without braces, and perform `\show`, showing `\c_space_tl`. In the current implementation the following happens

\exp_last_unbraced:No \show { } \c_space_tl
\exp_after:wN \show \c_space_tl
\show

A similar problem arises when doing

\exp_last_unbraced:Nf \mypkg_loop:N { \c_empty_tl }
\q_recursion_tail \q_recursion_stop

the argument f-expands to nothing, and the f-expansion is not stopped by the end of the argument, but tries to f-expand the quark which follows. Infinite recursion.

Both problems arise because the `\exp_last_unbraced` functions are optimized rather than being the naive `\exp_args:NNo \use:nn`. I don't see how to fix that without losing some speed, so I'd say that we should just document this edge case and give ideas on how to avoid it in real code.