The various entities that are organized in a tree (having a parent, children, a child_order) each implemented the relevant fields themselves, a massive duplication of code. The common parts are factored out into a parameterized OptionsTree role, corresponding to the Data role of the same name.
The sorted_children accessor that a few of these entities already had is made available in all of them, and is extended to use a specific collator instead of sorting by (lowercased) codepoint order.
This reduces the code size by more than four hundred lines.
The various entities that are organized in a tree (having a parent, children, a
child_order
) each implemented the relevant fields themselves, a massive duplication of code. The common parts are factored out into a parameterizedOptionsTree
role, corresponding to theData
role of the same name.The
sorted_children
accessor that a few of these entities already had is made available in all of them, and is extended to use a specific collator instead of sorting by (lowercased) codepoint order.This reduces the code size by more than four hundred lines.