On 16/02/2011 10:51, Heiko Oberdiek wrote:
> On Wed, Feb 16, 2011 at 07:04:42AM +0000, Joseph Wright wrote:
> 
>> Again, post the code :-) I wonder what exactly you mean here. With the
>> \expanded primitive (pdfTeX 1.50 or LuaTeX) you can do
>>
>>   \edef\a{\expanded{\def\a{b}}}
>>
>> and have \a => 'b'.
> 
> I doubt it. \edef is already expanding, \def is expanded
> but it is not executed as primitive. Depending on the previous
> definition of \a you get:
> * \a previously undefined: error message
> * \a defined, unexpandable: \a is macro => \def\a{b}
> * \a defined, expandable: \a is expanded until only non-expandable
>   tokens are left or there is an error. In case of success,
>   \a is a macro that starts with "\def", followed by the result
>   of fully expansion of "\a{b}..."
> 
> In most cases \edef\a{\def\a{b}} and
> \edef\a{\expanded{\def\a{b}}} are the same, but there might
> be differences, if \a is expandable and \noexpand or
> \the<token register> are used.

I must have misunderstood how \expanded works. I thought it could pull
off assignments within \edef, in the same way you can do with \directlua
and the appropriate Lua.
-- 
Joseph Wright