【发布时间】:2012-03-15 15:02:08
【问题描述】:
我在这个博客中看到了这段代码:Type-Level Programming in Scala:
// define the abstract types and bounds
trait Recurse {
type Next <: Recurse
// this is the recursive function definition
type X[R <: Recurse] <: Int
}
// implementation
trait RecurseA extends Recurse {
type Next = RecurseA
// this is the implementation
type X[R <: Recurse] = R#X[R#Next]
}
object Recurse {
// infinite loop
type C = RecurseA#X[RecurseA]
}
代码R#X[R#Next] 中有一个运算符#,这是我从未见过的。由于很难搜索(被搜索引擎忽略),谁能告诉我这是什么意思?
【问题讨论】:
-
“井号”有时被称为“八角”(谷歌搜索将我带到了这个页面)。
-
#+ 和#- 等其他运算符呢(请参阅github.com/tpolecat/doobie/blob/series/0.4.x/yax/h2/src/main/…)?有完整的清单吗?
标签: scala type-systems