On Mon, 10 Dec 2007 17:33:14 +0100, David Kastrup wrote:
Morten Høgholm
writes: I would assume the following should be equivalent except for the latter being expandable.
\def\cmd#1{\edef\tempa{#1}\expandafter\cmd\expandafter{\tempa}}
\def\cmd#1{\expandafter\cmd\expandafter{\expanded{#1}}}
No. The former would complain about isolated # tokens in #1 (and collapse double ones).
Ah yes (and sorry for the silly example above - it's really remarkably bad). You comment reminded me of something I added to l3tlp.dtx under the entry: r594 | morten | 2007-06-10 23:32:58 +0200 (Sun, 10 Jun 2007) | 2 lines Tried to make functions treat hash marks as uniform as possible % A word of warning is appropriate here: Token list pointers are % implemented as macros and as such currently inherit some of the % peculiarities of how \TeX\ handles "#"s in the argument of % macros. In particular, the following actions are legal % \begin{verbatim} % \tlp_set:Nn \l_tmpa_tlp{##1} % \tlp_put_right:Nn \l_tmpa_tlp{##2} % \tlp_set:No \l_tmpb_tlp{\l_tmpa_tlp ##3} % \end{verbatim} % |x| type expansions where macros being expanded contain |#|s do not % work and will not work until there is an |\expanded| primitive in % the engine. If you want them to work you must double |#|s another % level. All the more reason for \expanded... 'night, -- Morten