Tue, 19 Feb 2019 12:40:30 +0100
text/plain; charset=utf-8; format=flowed
> Normally, each template implementation has its own set of variables.
> This certainly keeps things separate but means that a single object
> type may end up with dozens of variables allocated for use by its many
> particular implementations. Although this is not an issue at the
> moment, I wonder if it might be in the future, when templates are used
in the early days of TeX that was in fact a big headache and there are
still a lot of traces in 2e where we tried so save individual tokens
like using \@plus (one token) to "plus" (4). Same for registers, when
there were less than 255 available for general use.
However with the current limits it doesn't seem at all likely that you
could actually hit a boundary.
> Would it be a worthwhile effort to conserve both csnames and registers
> by reusing some variables across template implementations for the same
> object type, or would it be better to stick to the convention of having
> completely independent sets of variables for each implementation, and
> wait to see if it becomes a concern later on?
On the whole I would say no, because if you do that then you need add a
lot of extra code to ensure that nested objects do not accidentally
overwrite stuff before it has been used successfully. This is is still
a possible headache if you nest the same type of objects, of course, but
then that is immediately clear to the programmer that the code must
account for that. If basically arbitrary code uses the same registers or
variables then the problem is much worse.