LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Classic View

Use Proportional Font
Show HTML Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Will Robertson <[log in to unmask]>
Wed, 24 Dec 2008 11:39:51 +1030
text/plain (40 lines)
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

ATOM RSS1 RSS2