根据 scala 规范, scala.Nothing 类型 - 所有类型的按钮。类型“Nothing”存在,但 Nothing 的实例不存在。
这个怎么运作:
def ??? : Nothing = throw new NoImplementedError
def sys.error(message: String): Nothing = throw new RuntimeException()
def sys.exit(status: Int): Nothing = {...}
但实际上,所有提到的方法都返回异常。例外def sys.exit
您能否详细说明一下Nothing类型。任何例子,解释。
谢谢!