【发布时间】:2011-11-05 22:17:16
【问题描述】:
这行得通
def func(f: => Int) = f
这不会(例如在课堂内)
type EmptyFunct = => Int
或
type EmptyFunct = (=> Int)
Scala 2.9 版 两个问题:
- 为什么语法糖在第二种情况下不起作用?
- 如何在没有语法糖的情况下定义这个函数?
【问题讨论】:
-
您能否举一个使用
EmptyFunct的例子来说明为什么() => Unit不符合您的需要?
标签: scala syntax-error scala-2.8