What happened to \expandaftern n? I have taken a look at the
recent activity on pdftex. It seems that there are so many things
developing, and much more in a "to do" state, that I am not surprised
that this got forgotten. However, I remember to have red that this
feature would probably be easy to implement, and it would be very
welcome by low level programers.
We should decide whether n is to be a single figure like
argument numbers following #, or an integer quantity that is read with
expansion, as happens almost everywhere when TeX is expecting an
integer.
The other thing I wanted to propose (yes, it is much easier to propose
than to actually program) is an intermediate scope of assignment
(between \local and \global). The idea is that the assignment be still
in force in the innermost group that encloses that which we are in. For
example, if the primitive is to be named \regional,
\def\foo{a}{\def\foo{b}{\regional\def\foo{c}\show\foo}\show\foo}\show\foo
the two first \show\foo would display 'c', while the third would
display 'a'.
By now, instead of thinking "how?" you are probably thinking "why?". I
found this very useful in two scenarios. The first one is to write
function-like macros. Supose that we want a macro to perform some
operations and return the value, then we could do
\def\myfunction{{% notice the aditional grouping
%
%Perform some operations, possibly long.
%Everyting is local, so we may use scratch registers and the control
sequences we wish,
%provided we are sure that the output routine will not be invoked
%
%Now, return the vaule
\regional\myregister\myregister %Or \regional\myregister\dimen0, or
\regional\foo{whatever}, or...
}%
}
The other situation is inside alignments. It often happens, or at least
it often happens to me, that we want to change the behavour of \\ for
the current row we are in; or for the entire alignment but still taking
advantage of other programmed features (for examlple, supose we have
\begin{matrix} ... \end{matrix}, or \begin{mymatrix} ...
\end{mymatrix}, or \mytable{ ... }, and we want to change just \\,).
Since TeX puts each alignment entry inside a group by itself, it is
impossible to perform such changes locally, since right after
\begin{matrix} or \mytable{, we are already at the first entry. And it
is likely that we cannot do the cange before entering the table,
because the macro may itself redefine \\.
I'm not saying that it is impossible to solve those problems, but that
a \regional assignment would make them much easier and cleaner. The
problem may actually be impossible to solve if we want not to just
change \\ in a particular use of a table, but if we want to program an
environment based upon an existing one.
Even though I don't know the internals of TeX, it seems that \regional
would be easy to implement. Currently, when we locally assign something
x, TeX saves the current value of x to be restored when
the group is exit, and then performs the assignment. If we prefix the
assignment with \regional, then tex would also save the newly assigned
value to be restored at the end of the group.
Incidentaly, just forgetting to restore would no work, for we could
have situations like this:
{\regional\def\foo{a}\def\foo{b}}% now \foo should be a.
Regards,
Javier A.