2012-03-30 62 views

回答

14

沒錯。

Input => Result[T]Function1[Input, Result[T]]的快捷方式。 它的abstrat方法

def apply(v1: Input) : Result[T] 

其中,當定義將實際的函數執行。

Scala的語法允許稱爲apply方法被稱爲靜默,即對於某些表達ee(x1, ... xn)將被轉換爲e.apply(x1, ... xn)

5

幾乎。它將Function [Input,Result [T]]擴展爲以Inputs作爲參數並返回Result [T](不是T)作爲結果的函數的類型。結果[T]將有關成功解析的信息載入T或在解析期間發生的錯誤。