AlgebraicJulia / AlgebraicJulia/GATlab.jl

Multiple Inheritance Design

未關閉
#128 0 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Julia
星號
43
分支
4
PR 合併指標
30 天內沒有已合併 PR

描述

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.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。