[Dev-luatex] Extension language integration of LuaTeX and LilyPond

Hans Hagen pragma at wxs.nl
Tue May 7 21:56:41 CEST 2013


On 5/7/2013 7:53 PM, David Kastrup wrote:

> The pipelining (rather than lexer switching) approach used by LuaTeX
> also means that error messages related to Lua/TeX interoperation are
> useless: they can't refer to the original source location since that has
> been lost during tokenizing and detokenizing.

lexer switching at the tex end (to lua) is somewhat tricky as it would 
involve an adapted lua parser while currently we just dostring on the 
tokenized and detokenized stream (we can think of going into some string 
mode but that would involve a more complex tex parser then; not 
something to look forward to, and more something for a dedicated engine)

from lua to tex is somewhat different; we already have node.write so at 
some point we can probably also have tex.writedimen, tex.writecs, etc 
(combining all in tex.write is too inefficient) that is more friendly, 
efficient and passes a reference instead and bypasses the parser

> "simple" in the implementation but not simple for doing actual
> interfacing and using the language for_extending_ the abilities for
> working in TeX rather than _replacing_ them.

given that you want users to use tex as input language, which is not 
always the best choice -)

> Well, let's just say that for LilyPond it has shown to be an important
> enough issue regarding usability to make private users keep throwing
> significant amounts of money at me because that kind of work is what
> empowers people with a user rather than a programmer background.

ok, but 'commercial' reasons are more drive for a special dedicated 
version for your application than generic extensions

> The kind of interfaces LuaTeX offers nowadays are appealing to people
> for whom TeX is too restricted.  But that's not an area with mass
> appeal.  Lua has a lot of potential to appeal to people for whom TeX is
> too _complex_.  Those who find themselves _lost_ with TeX, not those who
> know it so well that they can work with the added complexity of the
> LuaTeX interface, juggling with catcode regimes and whatever else you
> need to understand how to do even simple tasks reliably.

an option then is to do all in lua and not touch the tex end (apart from 
maybe some initializations)

> For example, it is quite silly that LuaTeX (at one point of time?)
> modified Lua's print routine so that it would output 1e-7 as 0.0.  Why
> would you even want to turn a number into a _printable_ representation?

or something readable into something backslashed -)

> Why not let Lua instead _return_ or pipeline a dimendef token with the
> right value?  If your value is a dimension, you don't want it
> disappearing in a comment or be combined with a preceding ^^ or have its
> decimal point be interpreted as an active character doing something
> else.  You want it to be a dimension.

sure, that's not much different from (already mentioned) node.write, but 
one reason we only did the node.write is that we first will clean up all 
error messages and do more separation

Hans

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


More information about the dev-luatex mailing list