[luatex] Behavior of node lists.
Stephan Hennig
mailing_list at arcor.de
Thu Nov 8 22:21:42 CET 2012
Am 08.11.2012 11:40, schrieb Hans Hagen:
> On 11/8/2012 9:15 AM, Taco Hoekwater wrote:
>> On 11/07/2012 07:37 PM, Stephan Hennig wrote:
>>>
>>> If N is known to be non-nil, e.g., a glyph node, is it save to call
>>>
>>> node.insert_after(nil, N, x) ?
>>>
>>> If the answer is 'Yes',
>>
>> Well, yes.
Thanks! Could that be clarified in the manual, please? Made me wonder
why head were needed to insert a node after another node the first time
I read it.
>> However I do not like the idea of reordering the arguments,
No problem. But let me respond to your arguments anyway.
>> because we have quite a lot of functions with 'head' argument, and
>> they always come first.
I don't think this is a fair argument. In node.insert_after, parameter
head plays only a secondary role. It is only used if current -- the
primary parameter -- is nil. And even then,
insert_after(head, nil, new)
is just an opaque way of saying
insert_after(nil, node.tail(head), new)
That is, the first argument <head> is actually never needed. Though, on
the former line, you can't easily tell what happens, just from the
arguments. You need to know about the current == nil case. And I
guess, insert_after calls node.tail(head) behind the scenes anyway when
current == nil. The current function insert_after is making things more
complicated than necessary, I think. Am I missing something?
> indeed reordering in no option
>
> (we could consider a two argument variant i.e. if two arguments, then
> assume N, x)
At the cost of an additional argument check. Undesirable as well ...
Best regards,
Stephan Hennig
More information about the luatex
mailing list