在Scala中进行一些函数式编程,并且来自Java背景,我倾向于抛出这样的异常:
throw new MyException("something is wrong")
但是,我也看到人们省略new:
new
throw MyException("something is wrong")
哪个更惯用?
scala
scala ×1