简单的东西
class Thunk[+A](body: => A) {
lazy val result: A = body;
}
它是在某处定义的吗?
或者也许更复杂一点
class Thunk[+A](body: => A) {
private[this] var evaluatedInternal = false;
lazy val result: A = {
evaluatedInternal = true;
body;
}
def evaluated: Boolean = evaluatedInternal;
}