In interface3.pdf sec 1.2, it says the function with a star can be fully expandable in x
, e
, f
, and the function with a hollow star can be fully exandable in x
and e
, and cannot be fully expanded within an f-type argument. My first question is
How deeply will f
-type argument expand the "hollow star"
And my main question: there are also some funtion without star, like \tl_set_eq:NN
, how will x
, e
, f
-type arguments regard it? I made some test and the output confused me.
\documentclass{article}
\begin{document}
\ExplSyntaxOn
\tl_new:N \l_tmpc_tl
\tl_new:N \l_tmpd_tl
\tl_set:Nn \l_tmpa_tl { abc }
\tl_set:Nn \l_tmpb_tl { ABC }
% I want to reset \l_tmpb_tl the same as \l_tmpa_tl, and set \l_tmpc_tl (\l_tmpd_tl)
\tl_set:Nf \l_tmpc_tl { \tl_set_eq:NN \l_tmpb_tl \l_tmpa_tl \l_tmpb_tl }
\tl_set:Nx \l_tmpd_tl { \tl_set_eq:NN \l_tmpb_tl \l_tmpa_tl \l_tmpb_tl }
\tl_show:N \l_tmpc_tl
\tl_show:N \l_tmpd_tl
\ExplSyntaxOff
\end{document}
After compiling with pdflatex, it output:
> \l_tmpc_tl=\tex_let:D \l_tmpb_tl = \l_tmpa_tl \l_tmpb_tl .
<recently read> }
l.11 \tl_show:N \l_tmpc_tl
?
> \l_tmpd_tl=\tl_set_eq:NN ABCabcABC.
<recently read> }
l.12 \tl_show:N \l_tmpd_tl
?
We can see that f
-type expanded \tl_set_eq:NN \l_tmpb_tl \l_tmpa_tl
into a tex primitive:
\tex_let:D \l_tmpb_tl = \l_tmpa_tl \l_tmpb_tl
However x
-type didn't do things on \tl_set_eq:NN
, it just left it in the output stream. ~~Why would this happen?~~ And how does latex3 expand a no-star-function?
UPDATE:
Countinuing reading interface3.pdf, I found it in sec 4.3:
Functions which are not “protected” are fully expanded inside an x expansion. In contrast, “protected” functions are not expanded within x expansions.
And I reached back to the definition of \tl_set_eq:NN
, it is "protected"
> \tl_set_eq:NN=\protected\long macro:#1#2->\tex_let:D #1= #2.
<recently read> }
l.13 \cs_show:N \tl_set_eq:NN
So it can't be expanded by x
-type argument, and protected function can be expanded by f
-type. Am I right here?
And then my second question becomes: Are all functions without a star protected?