Sunday, March 7, 2010

Programmer - In Scala, why can't I partially apply a function without explicitly specifying its argument types?

Programmer Question

This produces an anonymous function as expected (f is a function with three arguments):



f(_, _, _)


What I don't understand is why this doesn't compile, instead giving a "missing parameter type" error:



f(_, _, 27)


I need to specify the types of the underscores explicitly. Shouldn't Scala be able to infer their types given that the parameter types of the function f are known?



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails