# [Dev-luatex] new primitives

Hans Hagen pragma at wxs.nl
Fri May 6 11:41:07 CEST 2016

```On 5/6/2016 11:01 AM, Taco Hoekwater wrote:
> Hi,
>
>> On 05 May 2016, at 12:26, Hans Hagen <pragma at wxs.nl> wrote:
>>
>>> \appto, \preto, \apptocmd,... I think primitves would be much more
>>> faster and trustworthy.
>>
>
> Like Hans said: I think speed improvements are just wishful thinking.
> It is hard to beat the TeX language speed significantly from compiled
> C code if you are still doing more or less the same stuff the TeX
> language code would do. In (lua)TeX, useful speedups tend to come from
> doing a task differently, not from switching languages.
>
> Still planned for luatex is access to the macro replacement text
> as well as macro definition and possibly even alteration from the
> lua side of things. Altering macros from lua by using the lua token
> list interface would allow one to take macro parameters into account,
> and that would open up extra possibilities for sure. And it could
> improve reliability of such alterations, I assume. After some thinking,
> that sounds like a better way to go.

apart from pitfalls due to reference counting and grouping but we can
assume that only fearless users will use it -)

> In fact, thinking it over, I wonder whether we should not change
> \[e]toksapp and \[e]tokspre back to lua function calls?

(that would demands more juggling and have no advantage i.e. be slower
so probably not be used over the \expandafter{\the\foo... alternative}

well, we had similar discussions about more primitives, as in fact quite
some can be refitted to such calls; but that is all more a luatex 2+
issue than a version 1 issue as we have to draw the line somewhere

Hans

-----------------------------------------------------------------