scala - Scala 是否与 Haskell 的 undefined 等价?

标签 scala types

在 Haskell 中编码时,在编写应用程序框架时将函数结果定义为“未定义”会很有帮助。这样,可执行文件就会编译,让您按顺序处理您所关注的部分/案例。

Scala 中有什么等价的东西吗?我想写一些类似于:

def notAbleToWriteThisYet = undefined

最佳答案

def notAbleToWriteThisYet = sys.error("todo")

另见此 thread on the mailing list .

Scala 2.10.0-M1 :
def notAbleToWriteThisYet = ???

(在 Predef.scala 中定义为 def ??? : Nothing = throw new NotImplementedError 。)

关于scala - Scala 是否与 Haskell 的 undefined 等价?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8943967/

相关文章:

java - 在 Play 框架项目中放置 Java 库的最佳位置是什么?

java - Java 整数数组的高性能集合类数据结构

scala - Akka HTTP : Blocking in a future blocks the server

types - Golang gob : type not registered for interface:

c++ - 在 C++ 中查找对象的类型

node.js - 在 mongoose .d.ts 中分配自定义方法,这样我就可以在 typescript 中使用 mongoose 的任何地方使用它们

Scala的带对象+的中缀表示法,为什么不可能呢?

scala - def layout[A](x : A) = . .. Scala 中的语法

scala - 在函数中将 List[String] 转换为 ValidationNEL[String, A]

在 C 中使用 typedef 创建泛型