Subject: | |
From: | |
Reply To: | |
Date: | Wed, 24 Dec 2008 11:39:51 +1030 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On 24/12/2008, at 8:36 AM, Joseph Wright wrote:
> I was reading through part of l3tlp, and I came across:
>
> \def_long_test_function:npn{tlist_if_eq:nn}#1#2{
> \tlp_set:Nx \l_testa_tlp {\exp_not:n{#1}}
> \tlp_set:Nx \l_testb_tlp {\exp_not:n{#2}}
> \if_meaning:NN\l_testa_tlp \l_testb_tlp
> }
>
> Why is this \tlp_set:Nx plus \exp_not:n, rather than just \tlp_set:Nn?
I think that's to guard against # tokens. Since arbitrary token lists
could be being used in this function, you can't assume (as tlp's
usually do) that there won't be any #'s.
Took me a second to think about this, though, before I realised we're
dealing with unrestricted token lists. (Maybe this is a key difference
between a tlp and a tlist that I overlooked in my previous discussion
for them.) I'll add some text to the documentation for this function.
\documentclass[12pt]{article}
\begin{document}
\def\testa#1{%
\edef\x{\unexpanded{#1}}%
}
\def\testb#1{%
\def\x{#1}%
}
\testa{a#b}
\show\x
\testb{a#b}
\show\x
\end{document}
Cheers,
Will
|
|
|