Open jgraley opened 2 years ago
Of course, we have to consider the implications of patterns containing more-derived nodes than the ones in the X tree they are interacting with. But it's probably quite simple:
Policy could be described as "maximise specialisation" or "don't de-specialise"
suggests that
IsFinal()
is only ever used in checks (14 of them). And yetplus
(found in fall_out.cpp) flouts the rule, and gets away with it (until I tried using
IsFinal()
to solve #588 - found a different way though).So can finality of X tree nodes be relaxed? The rule is consistent with usage styles in which intermediates form a category system for the nodes that go in the X trees.
But another use case for inheritance is "bolt-ons" where you want to add a specialization of part of an existing hierarchy without disrupting that hierarchy (as with
StateLabel
). To be final-correct, a category of labels would need to be introduced egLabelCat
, and then existing patterns would need to be updated to useLabelCat
when allowingStateLabel
, which presumably wants to stealthily masquerade as aLabel
until searched for explicitly (OTOH, to excludeStateLabel
, a but-not pattern could be used).We could just remove
IsFinal()
etc and all the asserts and see what happens, but the implications should be contemplated and docs updated. Note that truly final nodes F have "X is (weak) subcategory of F" implies "X is F". There maybe assumptions along these lines after the ASSERTs listed above. So extra checks like "is F (weak) subcategory of X" might need to be added to prevent type mismatch errors emerging later.