tex.enableprimitives also fails for undefined primitives
Hello,
test file:
\def\msg#{\immediate\write16}
\msg{\meaning\Xpdfoutput}
\begingroup
\csname Xpdfoutput\endcsname
\endgroup
\msg{\meaning\Xpdfoutput}
\directlua{tex.enableprimitives('X', {'pdfoutput'})}
\msg{\meaning\Xpdfoutput}
\csname @@end\endcsname\end
Result: 3 x "undefined"
After reading the documentation I expected:
2 x "undefined", 1 x "\pdfoutput"
| Then it will check for the existence of the constructed csname. If the
| csname is currently undefined (note: that is not the same as \relax), it
| will globally define the csname to have the meaning: run code belonging to
| the primitive `name'. If for some reason the csname is already defined, it
| does nothing and tries the next pair.
Either there is a bug in the implementation or in the
description ("is already defined" --> "is or was already defined").
Workaround:
\directlua{tex.enableprimitives('Workaround', {'pdfoutput'})}
\global\let\Xpdfoutput\Workaroundpdfoutput
Yours sincerely
Heiko
Heiko Oberdiek wrote:
| Then it will check for the existence of the constructed csname. If the | csname is currently undefined (note: that is not the same as \relax), it | will globally define the csname to have the meaning: run code belonging to | the primitive `name'. If for some reason the csname is already defined, it | does nothing and tries the next pair.
Either there is a bug in the implementation or in the description ("is already defined" --> "is or was already defined").
That was an implementation bug. The fix is in SVN as #2237. Best wishes, Taco
participants (2)
-
Heiko Oberdiek
-
Taco Hoekwater