Scala, currying and overloading
问题 Say you have the following: foo(x: String)(y: Int): Int foo(x: String)(y: Double): Int Scala does not allow such expression. As far as I can see, the reason for this is that foo("asdf") does not have a well defined type (it's either Int => Int or Double => Int). Is there a reason why such "polytyped" functions should not be allowed? 回答1: Overloading resolution in Scala takes only the first parameter list into account. That's why alternatives must differ already in this list. There's a good