LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

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

Print Reply
Subject:
From:
Joseph Wright <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Wed, 24 Dec 2008 08:28:04 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (47 lines)
Will Robertson wrote:
> 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}

I'd (broadly) thought of that, but had got the impression that the
restrictions which apply to tlp data also apply to tlists.  Re-reading
l3tlp, I see that I am mistaken.  I think in the discussion of
tlp/tlist/toks, the relationships tlist ~ toks (in terms of # behaviour)
and tlist ~ tlp (in terms of \edef behaviour) could be pointed out
explicitly.
--
Joseph Wright

ATOM RSS1 RSS2