Параметры по умолчанию с каррированием

I can define a function as:

def print(n:Int, s:String = "blah") {}
print: (n: Int,s: String)Unit

I can call it with:

print(5) 
print(5, "testing")

If I curry the above:

def print2(n:Int)(s:String = "blah") {} 
print2: (n: Int)(s: String)Unit

I can't call it with 1 parameter:

print2(5)
<console>:7: error: missing arguments for method print2 in object $iw;
follow this method with `_' if you want to treat it as a partially applied function
       print2(5)

I have to supply both parameters. Is there some way around this?

8
задан ssanj 22 February 2011 в 05:35
поделиться