【发布时间】:2010-08-25 16:15:31
【问题描述】:
我知道这个问题已经多次以不同的方式提出。但我仍然不清楚。有没有办法实现以下目标。
def foo(a:Int, b:Int) = {}
foo(a,b) //right way to invoke foo
foo(getParams) // is there a way to get this working without explicitly unpacking the tuple??
def getParams = {
//Some calculations
(a,b) //where a & b are Int
}
【问题讨论】:
-
如果 foo 恰好是某个类的构造函数怎么办?
标签: scala parameters tuples