On 24. 01. 2017 17:33, Hans Hagen wrote:
\def\csnewlocalbox#1{\expandafter\newlocalbox\csname #1\endcsname} \def\csboxnumber#1{\expandafter\number\csname #1\endcsname}
\starttext
\newbox\MyBoxA \number\MyBoxA
\dorecurse{2} { \dorecurse{1000} { \csnewlocalbox{TempBox#1-1}% \csnewlocalbox{TempBox#1-2}% \csnewlocalbox{TempBox#1-3}% \csnewlocalbox{TempBox#1-4}% \csnewlocalbox{TempBox#1-5}% } \writestatus{!!!}{#1 million done} #1: \csboxnumber{TempBox#1-1}\par #1: \csboxnumber{TempBox#1-2}\par #1: \csboxnumber{TempBox#1-3}\par #1: \csboxnumber{TempBox#1-4}\par #1: \csboxnumber{TempBox#1-5}\par }
\newbox\MyBoxB \number\MyBoxB
\stoptext
even then you only get 5000 boxes defined ... Well, that's because I was impatient and have changed a 1000000 to a 1000 ;-) you can reset the storag of course but you still have 5000 hash entries (mening \undefined then) with names like TempBox*-* That's very good info, thanks!
\starttext
\bgroup \newlocalbox\foo \setbox\foo\hbox\bgroup bar \ifdefined\oof\else\newbox\oof\fi \global\setbox\oof\hbox{foo} \egroup \egroup
\box\oof
\stoptext
when we would reset the allocator count then \oof would still be ok but its slot would be reallocated at some point by \newlocalbox I hope you don't mind explaining this further, as I'm lost.
1. I was unable to produce this effect. Should it happen with the \newlocalbox defined in this thread, or some hypothetical \newlocalbox (which would share the allocation counter with \newbox?). I tried both your \newlocalbox and elocalloc's \locbox, and didn't manage to reallocate \oof's register. But maybe this question is bogus, as: 2. I don't understand why it is important to use \newbox within \setbox\foo\hbox{...} Don't we get the same result in the following? \starttext \bgroup \newlocalbox\foo \setbox\foo\hbox\bgroup bar \egroup \ifdefined\oof\else\newbox\oof\fi \global\setbox\oof\hbox{foo} \egroup \box\oof \stoptext Best, Sašo