i want to propose two new primitives for LuaTeX:
- The existing `\luafunction` has some similarities to `\count`, `\dimen`, `\skip`. Especially for most use cases, you will have to allocate a number, but there is no equivalent to `\countdef` etc.
I think LuaTeX would benefit from `\luafunctiondef`, such that e.g. `\luafunctiondef\something1` would define `\something`, such that `\something` is equivalent to `\luafunction1`.
What is the difference to creating a regular macro? This would allow `\something` to be expandable in a single step, which is especially important for emulating primitives from other engines with lua code.
- Additionally it would be useful to allow "expandable temporary macro definitions". So for example
would expand to
This allows using the TeX macro argument parser inside expandable macros, especially when the delimiter can change. For example if you implement a property list as `\@key key1\@value value1\@key key2\@value value2...`, you can create an expandable macro to ge the value of key `#2` without requiring recursive calls with
Another use-case would be implementingan expandable version of functionality similar to the expl3 `\seq_map_inline:Nn`.
What do think? Is there any chance to see something like this in LuaTeX?
I attached a first implementation as patch against the current experimental branch.