# LuaTeX: new primitives, new names

There has been quite a bit of dicussion recently on the LuaTeX mailing list about primitive names. The basic set of primitive names provided by TeX has already been extended by e-TeX, pdfTeX and XeTeX. While e-TeX primitives have names which express only the function (such as `\detokenize`), both pdfTeX and XeTeX have tended to add the engine name to all new primitives. So for example pdfTeX provides the `\pdfprimitive` function, which always carries out the orginial function of a name, even if it has later been redefined:

```\let\everypar\undefined
% \everypar{Some stuff} % Gives an error
\pdfprimitive\everypar{Some stuff}```

will, for example, add material to `\everypar` despite the redefinition.

In LuaTeX, the idea of adding an engine-specific prefix has been abandoned. The example above shows one reason why: `\pdfprimitive` makes more sense with the name `\primitive` (which is what LuaTeX calls it). The problem with this is that name clashes are marginally more likely without a prefix (for example, `\expanded` is used in ConTeXt as a macro, but this is planned as a primitive for pdfTeX 1.50).

On the other hand, LuaTeX is a fundamental break with previous engines, as the internal changes mean that it may give different line breaks and so on to earlier systems. Thus the argument for new, logical, primitive names is that moving to LuaTeX is not the same as moving from TeX to pdfTeX or pdfTeX to XeTeX. There will be changes, and the user (or package developer) will need to think about them before diving in.

Overall, I think the LuaTeX idea is the best in the long term. Primitives which have well specified names help everyone, and some times change is necessary. I’ll be interest to see if the `\directlua` primitive for actually using Lua ends up with a shorter name (just `\lua`, anyone?).

### 1 thought on “LuaTeX: new primitives, new names”

1. Will

I was going to comment on the mailing list, but I didn’t want to add to the noise there 🙂

As always, I’m fairly non-committal; I can see both sides of the argument.

The problem arises because I think the long-term suggestion is to eventually replace the command-line utility `latex` with a LuaTeX based format. Given that backwards compatibility is guaranteed not to hold in some page layout cases, I’m not sure if this will ever actually happen (although different hyphenation patterns already have the same problem).

The only problem is when an old document is processed with a new invisibly-Lua `latex` and `pdflatex` and clashes occur. Unlikely, sure, but the TeX community is remarkably stubborn about preserving backwards compatibility. Having LuaTeX introduce primitives with non-prefixed names reduces the chances that the command line `(pdf)latex` program will end up using it.

But if that never happens, then it doesn’t matter what the new primitives are called. And if the LuaTeX team aren’t fussed about what the command line utility to execute LaTeX2e is called, then it’s certainly not be a strong reason for them to reduce the “cleanliness” of their naming schemes.

And when we have an ltx3 format it won’t matter anyway 🙂