I've realized that there's more than one way to do multiple inheritance, and each one makes sense in different context.
One way is the way we've been planning to do, which is "union of scopes". I.e. the GATSegments that make up a multiply inherited theory are the union of the GATSegments for the theories that we are inheriting from, keyed by ScopeTag.
However, there are also situations, and I'm thinking of the DEC in particular, where we want to do something like "composition over inheritance."
"Composition over inheritance" is a phrase in object-oriented design. Basically, you can "add a field" to a class in two ways:
class Point2d {
x: int
y: int
}
class InheritancePoint3d extends Point2d {
z: int
}
class CompositionPoind3d {
parent: Parent
z: int
}
Each has its own benefits. Inheritance means that your class is structured flatly, while composition allows more flexible use, for instance
class TwoPoint2ds {
pt1: Point2d
pt2: Point2d
}
This second way makes more sense for the DEC, because we want to be able to write something like:
@theory DEC begin
R::RAlgebra
Form0::Module(R)
Form1::Module(R)
Form2::Module(R)
d::LinMap(Form0, Form1)
d::LinMap(Form1, Form2)
...
end
Ultimately I think we should figure out a clean way of supporting both styles of extending theories.
I've realized that there's more than one way to do multiple inheritance, and each one makes sense in different context.
One way is the way we've been planning to do, which is "union of scopes". I.e. the GATSegments that make up a multiply inherited theory are the union of the GATSegments for the theories that we are inheriting from, keyed by ScopeTag.
However, there are also situations, and I'm thinking of the DEC in particular, where we want to do something like "composition over inheritance."
"Composition over inheritance" is a phrase in object-oriented design. Basically, you can "add a field" to a class in two ways:
Each has its own benefits. Inheritance means that your class is structured flatly, while composition allows more flexible use, for instance
This second way makes more sense for the DEC, because we want to be able to write something like:
Ultimately I think we should figure out a clean way of supporting both styles of extending theories.