Hello, here is an example of some behaviours I find quite strange... It is a really short and simple example in plainTeX. It shows that if we have set \localleftbox or \localrightbox once, every line will have two more (empty) nodes. I think this behaviour is quite uncoherent, because packages (like GregorioTeX) set some \localleftbox and \localrightbox and then unsets them, so if someone wants to count the nodes of a line, this result will depend if he has a score in his document or not, even if he counts the nodes of a line that has nothing to do with a score... I think it would be better if these empty nodes were suppressed... The other behaviour I find strange is that an attribute on a node can be both 1 and -1... It's just a curiosity, as the good way to test if an attribute exists is (I think) to call node.has_attribute with only two arguments. Also, is there a way to get the value of an attribute on a node by doing something else than testing some? Thank you in advance, -- Elie
Elie Roux wrote:
The other behaviour I find strange is that an attribute on a node can be both 1 and -1... It's just a curiosity, as the good way to test if an attribute exists is (I think) to call node.has_attribute with only two
setting an attribute to -1 is equivalent unsetting it (so the has_attribute test then returns nil); however the attribute node is still there since it's more efficient to release it when the node itself is released; we experimented with different implementations (sets, etc) but the current was the most efficient we might use other negative values for special purposes (at least that was the original idea) so don't make code that depends on negative values because at some point we might make use of them
arguments. Also, is there a way to get the value of an attribute on a node by doing something else than testing some?
you could follow the linked list of attributes of a node but in general the test local a = node.has_attributes(n,123) if a then ... end is more efficient Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Elie Roux wrote:
Hello,
here is an example of some behaviours I find quite strange... It is a really short and simple example in plainTeX. It shows that if we have set \localleftbox or \localrightbox once, every line will have two more (empty) nodes. I think this behaviour is quite uncoherent, because packages (like GregorioTeX) set some \localleftbox and \localrightbox and then unsets them, so if someone wants to count the nodes of a line, this result will depend if he has a score in his document or not, even if he counts the nodes of a line that has nothing to do with a score... I think it would be better if these empty nodes were suppressed...
The problem is that you can not truly unset the \local{right,left}box because they were meant for partial use within just a few lines inside a paragraph. \localleftbox = {} just assigns an empty \hbox{}, which is not the same as nothing at all. The only way to get rid of the content is via grouping. I have options: 1. delete the empty nodes as you propose and/or make {} mean: unset it 2. switch the input syntax to \box-style format with an explicit \hbox (this has my preference) 3. do nothing Best wishes, Taco
Taco Hoekwater a écrit :
1. delete the empty nodes as you propose and/or make {} mean: unset it
I still think it's the best solution...
2. switch the input syntax to \box-style format with an explicit \hbox (this has my preference)
I don't really like this one, because it totally breaks retro-compatibility, to gain something less important... -- Elie
Elie Roux wrote:
Taco Hoekwater a écrit :
1. delete the empty nodes as you propose and/or make {} mean: unset it
I still think it's the best solution...
Ok, your bug report convinced me. Even so, it may take a few weeks before I get around to fixing this, so you will have to be patient for a bit longer. Best wishes, Taco
I have finally found the bug I was tracking in Gregorio for some time... Here is an example where putting empty boxes does not lead to a strange behaviour, but to a really buggy behaviour: If an empty \localleftbox is set with attribute 1, and after that we set the attribute to -1, the lines after the first will still have the attribute set to 1, because the empty box will set it... It is I think extremely confusing, and it's a bug that is difficult to track (even if now that I have the solution it will be a one-liner patch to fix it). So I insist, I think that removing the nodes will be much better, because this kind of behaviour will certainly appear with a lot of styles using \localleftbox. -- Elie
participants (3)
-
Elie Roux
-
Hans Hagen
-
Taco Hoekwater