[Dev-luatex] new primitives

Hans Hagen pragma at wxs.nl
Thu May 5 12:26:32 CEST 2016

On 5/4/2016 10:29 PM, linuxss Stonys wrote:
> Hi,
> I saw you are implementing new primitives such as appending to token
> list. This is interesting idea and I wander could you implement more new
> useful primitives like \appenddef, \prependdef where it would add
> something at begin or at the end of macro. And where you should not care
> about commands arguments. There is etoolbox with similar commands like

i guess most macro packages implement appending and prepending stuff

> \appto, \preto, \apptocmd,... I think primitves would be much more
> faster and trustworthy.

we have no plans for more primitives because there would be no end to it 
(every macro package has its own demands anyway)

appending and prepending to token lists makes sense because they are 
registers and can be considered kind of containers

concerning performance: there is less gain than one thinks as texs core 
operations are pretty well optimized (only on extremely large token 
lists one can measure a gain) and speed of tex is determined by many 
more factors (measuring some single aspect hardly makes sense) an dfor 
instance a few bad styling options (inefficient font switches and so) 
have more impact than a bit macro expansion

concerning trustworthy: given the macro language and expansion one needs 
to know a bit what could happen and primitives don't make that any better

> Sometimes I get problems with \apptocmd when using it in tex4ht and
> trying to append to command with semicolon and it doesn't appends macros.

that's a matter of programming (and again very dependant of what goes in 
such a macro call)


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

More information about the dev-luatex mailing list