[luatex] Behavior of node lists.

Stephan Hennig mailing_list at arcor.de
Sat Nov 10 17:54:38 CET 2012


Am 10.11.2012 12:28, schrieb Hans Hagen:
> On 11/10/2012 11:55 AM, Stephan Hennig wrote:
> 
>> Good point, too.  But let me ask again, the returned nodes are always
>> the same as those given as arguments, with changed fields, but they
>> never change identity?  That's not clear from the manual.
> 
> Sure, why should they change identity?

I'm not saying they should.  I'm asking, if they do.  As long as a
function doesn't work against its specification, it can do anything.  In
this case, it's the fact that there are return values at all that
triggers doubts about the identity of nodes.  That return values are
provided for the user's convenience and identity of nodes indeed never
changes is not part of the specs, currently.  Full specs, please!


> (maybe you think that a head node is something special, but it's not, 
> it's just a name for the first node in alist)

Thanks, but I'm aware of that.


>> The node 'list' terminology is a bit confusing.  These node 'lists' are
>> actually trees.  The latter having sub-trees with their own root (head)
>> nodes etc.  A list, in contrast, usually has one invariant head node
>> (putting aside operations that explicitly change a list head).  Even
>> though I guess, for someone with a strong TeX background it is a trivial
>> fact, I think the manual should be a bit more explicit about what head
>> exactly to use in insert_before/after.
> 
> it's not invariant
>
> [...]

Please note the text in parenthesis.


> the manual is not a 'tutorial in programming' and 'linked lists'; in 
> fact: a programmer should recognize the concept

Hans, I'm not asking for a tutorial in programming.  In fact, I feel
quite comfortable handling lists and trees.  I'm just asking for full
specs in the manual.


> but a tex macro writer might be somewhat confused as tex itself
> because there is talk like "the main vertical list" in manuals but on
> the other hand, once one starts messing with that one knows about the
> stuff (there is no access to the list at the tex end apart from some
> \last.. and \un.. operations and maybe un*box and vsplit resemble
> some messing list)
> 
> concerning a tree: indeed it is a tree with some nodes (not only hlist 
> etc but also glyphs that are ligatures) being trees themselves
> 
> actually, the tex tracing primitives (showbox etc) will show you that 
> kind of nesting in the log

I know there's a TeX tradition in the term list.  While I'm quite
comfortable handling lists and trees, I'm not that good at interpreting
all TeX semantics of nodes.  That's why I wrote "for someone with a
strong TeX background it is a trivial fact ...".  But since LuaTeX is
about opening-up and provides new means (data structures) to wrench
TeX's innards, I think it should give at least a big picture about what
the data structures are.  My TeX background doesn't allow me to do
intrusive node list manipulations, but I'd like not to need to read the
TeXbook to know how node lists are organised, e.g., they can be nested,
they are a-cyclic (are they?) etc.

In the LuaTeX reference manual, you're completely hiding the fact that
node lists are trees.  That makes me sometimes wonder what head actually
refers to.  Not in the sense that I have no clue.  But in the sense that
the reference manual is ambiguous.

Best regards,
Stephan Hennig



More information about the luatex mailing list