Re: Recent releases of ConTeXt LMTX crash at \starttext when expl3 is loaded

Max Chernoff via ntg-context <[email protected]> Wed, 05 Aug 2026 02:13:27 -0600
Newsgroups gmane.comp.tex.context
Message-ID <[email protected]>
Hi Vit, Hans,

On Tue, 2026-08-04 at 10:45 +0000, [email protected] wrote:
> Cross-format modules like the Markdown package for TeX often benefit
> from using expl3 instead of TeX,

The fundamental problems here are that:

1. expl3 is relatively slow to load from scratch.
2. expl3 is not preloaded into the ConTeXt format.

I don't think that there's anything that can be done about (1), since
expl3 isn't slow because it's bloated or poorly-written, but because it
offers so much functionality. So unless expl3 loses functionality
somehow, there's probably no way to fix this. But the expl3 load times
in ConTeXt are _so_ much better since Joseph reimplemented the Unicode
table stuff in Lua, so maybe there are some other similar places that
can be sped up.

I don't think that there's anything to be done about (2) either: Hans
has been focusing on reducing format build times, and adding expl3 would
slow that down again; hardly any ConTeXt packages use expl3, so there's
not much benefit to adding it; and expl3 conflicts with a few ConTeXt
features and is occasionally broken, so adding it to the ConTeXt format
might break things for non-expl3 users too.

> which allows them to write high-level
> code that is difficult to express in Lua.

If you can't implement something in Lua, then you're not trying hard
enough ;).

> demonstrate the usefulness and perhaps
> inspire other module authors to consider this approach.

I suspect that this will be a rather hard sell, since I've written quite
a bit of expl3 and generally like using it

    https://tex.stackexchange.com/search?q=user%3A270600+ExplSyntaxOn

    https://github.com/search?q=org%3Alatex3+author%3Agucci-on-fleek&type=commits

but even I have never used it in ConTeXt before. expl3 is unbeatable for
when you need to program things using only TeX macros, but expl3 is
fairly weak for actual typesetting, and Lua is a better programming
language, so there aren't many places in ConTeXt where expl3 would be
very useful.

On Tue, 2026-08-04 at 13:34 +0200, Hans Hagen via ntg-context wrote:
> - fot context the lua interfaces are ok (i admit that because luatex /
> luametatex comes from context dev i'm biased) and we extend when we need
> more : the tex / lua / metapost mix is deliberate choice

Yup, the ConTeXt Lua interfaces are really nice, and OpTeX's are pretty
good too, but the other formats provide almost no interfaces which makes
using Lua quite annoying.

> - i bet these interfaces also add runtime

It depends. Lua is generally faster than expl3, but not usually by that
much:

    https://github.com/latex3/latex3/pull/1557#issuecomment-2226765469

and expl3 is nearly always faster than if you were to implement
something using "classic" TeX macros.

> - and personally i find expl unreadable and from what i've seen i can't
> wrap my mind around it

It definitely takes a bit of practice to get used to it, but I find it
_much_ easier to read than the \cl@ss@c\@@style of writing macros that
"plain.tex" and the 2e kernel use.

> context and latex are just different things, the fact that there are
> some cross-package modules is nice but not a target (as people can just
> use the macro package that provides them what they need)

I'm also quite fond of the hybrid solution of using LaTeX from within
ConTeXt:

    https://tex.stackexchange.com/a/739944/270600

    https://github.com/jasperhabicht/hawkdraw/blob/main/t-hawkdraw.mkxl

This isn't really useful for a markdown package, but it's great for
drawing packages since it means that you never need to recompile
unchanged drawings.

Thanks,
-- Max
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________