Sender: |
|
Date: |
Wed, 12 Aug 2009 06:16:33 +0100 |
Reply-To: |
|
Subject: |
|
MIME-Version: |
1.0 |
Content-Transfer-Encoding: |
7bit |
In-Reply-To: |
|
Content-Type: |
text/plain; charset=ISO-8859-1 |
From: |
|
Parts/Attachments: |
|
|
Will Robertson wrote:
>> Does it inspect the argument at runtime to figure out which of the two
>> cases is at hand? Looks rather fragile & syntactic sugar to me.
>
> The heuristic is fairly safe, I believe. It uses \ifx\noexpand#1#1 to
> detect whether the argument is a macro, and if it is not inserts \the to
> extract the value of the toks/dim/whatever. The whole thing takes place
> inside a \romannumeral expansion so the number of expansion steps is
> constant.
Thus far, all seems to work okay. Whether that means it never goes wrong
...
> (There is no error checking at present, but may be added conditionally
> in the future.)
Will, don't forget that it does catch things like:
\csname l_does_not_exist_tl\endcsname
which using :o will not. (Variables are not meant to equal \relax under
any circumstances, according to the LaTeX3 specs.)
>>> So V is preferred for accessing variables (as the internal structure is
>>> not important),
>>
>> Wouldn't you still need to know the variable's "internal structure"
>> when setting it?
>
> But setting does not need to be done in a known number of expansion
> steps, so the setting functions \toks_set:Nn, \tl_set:Nn, etc., all
> behave analogously.
As Will says, we have set functions for everything, and also use
functions, the idea begin that you can always know that
\<var>_use:N \l_my_var
and
\<var>_set:Nn \l_my_var {<content>}
will be correct (of coure <content> must be correct here!).
--
Joseph Wright
|
|
|