Scala - 嵌套类型关键字
Scala - Nested type keyword
我在查看 Akka 源代码时遇到了以下内容
type Repr[+O] <: FlowOps[O, Mat] {
type Repr[+OO] = FlowOps.this.Repr[OO]
type Closed = FlowOps.this.Closed
}
type Closed
谁能给我解释一下这是怎么回事??
FlowOps[O, Mat] {
type Repr[+OO] = FlowOps.this.Repr[OO]
type Closed = FlowOps.this.Closed
}
是一个compound type with a refinement。也就是说,FlowOps[O, Mat]
本身可以有任何 Repr
和 Closed
类型的成员;在这里我们需要特定的。此类型用作类型成员 type Repr[+O]
.
的上限
我在查看 Akka 源代码时遇到了以下内容
type Repr[+O] <: FlowOps[O, Mat] {
type Repr[+OO] = FlowOps.this.Repr[OO]
type Closed = FlowOps.this.Closed
}
type Closed
谁能给我解释一下这是怎么回事??
FlowOps[O, Mat] {
type Repr[+OO] = FlowOps.this.Repr[OO]
type Closed = FlowOps.this.Closed
}
是一个compound type with a refinement。也就是说,FlowOps[O, Mat]
本身可以有任何 Repr
和 Closed
类型的成员;在这里我们需要特定的。此类型用作类型成员 type Repr[+O]
.