Common programming languages (C
).
// foo is global scope
int foo = 0;
int main() {
// bar is local scope within main
int bar = 1;
}
Let's consider LaTeX3
\documentclass[]{article}
\ExplSyntaxOn
\cs_set:Nn \create_list:n
{
\tl_set:Nn \l_my_tl {(#1)}
}
\NewDocumentCommand\uselist{m}
{
\create_list:n {#1}
\tl_use:N \l_my_tl
}
\ExplSyntaxOff
\begin{document}
\uselist{2}
\end{document}
In LaTeX3
I expected the scope of \l_my_tl
is a body of \create_list:n
. But \l_my_tl
visible also from \uselist{m}
macro. Why is that? What am I misunderstanding here?