[NTG-context] scope

Hans Hagen j.hagen at xs4all.nl
Sun Feb 14 17:56:44 CET 2021


When you allocate a new register (with e.g. \newdimen) that is always a 
global definition (kind of a tex tradition). As a (likely to stay) 
experiment I added

   \newlocaldimen    \foo
   \setnewlocaldimen \foo 123pt

and comparable helpers. Some more can be found in lowlevel-scope.pdf in 
the distribution. The idea is that users who write their own macros that 
need 'variables' can define them locally without the danger for clashing 
with system ones (or each others macros). Actually, global assignments 
only affects that variable, so one can do

... use \foo

Best use names like \mydimena etc in order nnot to clash with system 
ones (that can be protected against overload). In spite of redefinitions 
each time a macro using it gets expanded, performance is quite okay.

It falls in the category "interesting hacks but maybe not needed because 
never asked for", but on the other hand, sometimes availability creates 
retrospective demand. (I also did \newlocalread and added some extra 
random access hackery to \read, so who knows what users will abuse that 
feature for.)


                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl

More information about the ntg-context mailing list