Re: [frogs] Stepping into the code for nested properties

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]


I did some digging with the debugger (and pretty-print :)
It seems that when overriding nested props are treated exactly like
non-nested ones, as Neil suggested. When you do an \override, in the
CAR of the current property list is placed a new list with the
elements of the same list:
(<many elements>) -> ((<many elements>) <many elements>)

The new value is then prepended, but the old one is maintained in the CAR:
((<the_element> <other elements>) <the_element> <other elements>) ->
(<the_element_new> <the_element> <other elements>) <the_element>
<other elements>)

So we end up with a "backup" copy of the list and the current list in
the CAR, with two copies of the modified prop: old and new values.
Nested properties are treated similary. If you do an override, say in
(bound-details left <an_item>) only the sublist of the nested prop is
duplicated and not the whole prop:

(bound-details (left <my_item> <other_items>)) ->
(bound-details
           (left <my_item_new> <my_item> <other_items>)
           (left <my_item> <other_items>))

I hope I got this correctly! :)

Now, what seems to trigger the problem is that in the debugger I see a
call to execute_revert_property() before every
execute_override_property(). So the code:

\override TrillSpanner #'(bound-details left Y) = #'99

seems to generate a revert on #'(bound-details left Y) before setting
the property.
If this is the first override in that context
execute_revert_property() just returns. BUT if an override was already
done the CAR of it's properties contains the current used properties.
nested_property_revert_alist() will then find the property you are
overriding and it pops it out of the list. After the override you end
up with something like this:

(bound-details
           (left <my_item_new> <other_items>)
           (left <my_item> <other_items>))

note that in the first instance of (left) the old value of <my_item>
is missing, since it was popped by the revert.

When you explicitally do a \reverts on this property,
nested_property_revert_alist() seems to care only of the first (left)
that it encounters, and pops (correctly) <my_item_new>, leaving the
nested property without a copy of <my_item>.
This extends easily to the \revert-one-some-prop breaking after an
\override-another: nested_property_revert_alist() always pops out the
list the \reverted item, even if it is the only copy present. It seems
then that other parts of the program just access the first instance of
the nested prop they encounter, thus not finding it's subproperty,
this even if subsequently in the list other copies of the nested
property (with all elements) are present.
Can't the default value just be copied from the "backup" part of the
context's property alist, which is always present?

Hope I was not too boring :)

cheers,
Rodolfo

---
----
Join the Frogs!


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/