[Dev-luatex] Proposal for new primitives

Marcel Krüger tex at 2krueger.de
Wed May 2 22:43:38 CEST 2018

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 
    \scantexmacro#1#2\stop{-#1-#2-}abc\stop def 
  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.

Best regards 
Marcel Krüger
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-luafunctiondef.patch
Type: application/octet-stream
Size: 10945 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/dev-luatex/attachments/20180502/2fba62ef/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-scantexmacro.patch
Type: application/octet-stream
Size: 4898 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/dev-luatex/attachments/20180502/2fba62ef/attachment-0001.obj>

More information about the dev-luatex mailing list