## 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 >>]

 Subject: Re: Fully expandable "x" argument (was "expandable \uppercase...") From: Bruno Le Floch <[log in to unmask]> Reply To: Mailing list for the LaTeX3 project <[log in to unmask]> Date: Mon, 21 Feb 2011 06:20:42 -0500 Content-Type: text/plain Parts/Attachments: text/plain (67 lines)
> I am especially interested in this last part with the e-type argument,
> especially its relationship to LuaTeX's \expanded primitive (also available
> in pdfTeX >= 1.5, if it's turning up in TL this year?). Do you think that
> we'd be able to add 'e' as an argument type using your code above where
> necessary and replace it with \expanded if it's available? Or will there be
> edge cases to cause us headaches?

No headaches, I think :). It all depends on whether the test
\token_if_expands:N that I used (not \token_if_expandable:N
provided by l3token) is reliable. The only other fine point that I see
is renamed versions of \noexpand and \unexpanded. Currently, I
only detect \noexpand, \unexpanded, \exp_not:N and \exp_not:n,
but I can do some rewrite to use the meaning rather than the string
representation of the tokens.

Of course, I will need to read some documentation (if it exists) on
\expanded, to know how it behaves exactly (protected control
sequences?)

> Another function I'd like to see based on this work: expandable nestable
> function mapping. E.g.,

I'm very interested in knowing what should be added, thanks.
Expandable nestable function mapping requires the conversion to carry
around an argument (the function to map), so every function in the
package needs one more argument. I'll do that some time this week.
That will naturally gives something like

\tl_map_function_item_brace_space:nNNN {ab~{cd~{}}~} \foo_i:N
\foo_ii:n \foo_iii:

=>

{
\foo_i:N a \foo_i:N b \foo_iii:
\foo_i:n {
\foo_i:N c \foo_i:N d  \foo_iii:  \foo_ii:n {}
}
\foo_iii:
}

> (I haven't looked into doing it non-expandably, which would be more robust.)

My claim is that expandable is just as robust as non-expandable if
- we have access to the full argument (i.e. no peeking ahead)
- there is no token of catcode 1 other than a true "{"
- there is no token of catcode 10 and character code other than 32 (space).

If these conditions are satisfied, then everything can be done
(except, of course, assignments). It will just be much slower in most
cases.

Note that the third condition is actually much less than it seems
because catcode 10 tokens in the input are automatically converted to
"true" spaces:

\def\space{ }
\ExplSyntaxOn     \def\tilde{~}
\ifx\space\tilde   \show\true    \else  \show\false  \fi

shows "\true".

Regards,
Bruno