Scala, currying and overloading

后端 未结 3 1915
Happy的楠姐
Happy的楠姐 2020-12-06 00:41

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 ca

3条回答
  •  眼角桃花
    2020-12-06 00:52

    This isn't the first time this has been asked: it was asked back in 2009. Unfortunately Martin didn't explicitly state what the issues were, other than that it would require a fairly extensive spec change on how overloading works. I've looked at the spec and it's not clear to me where the core issues lie, but I'm not skilled enough in the spec to give a definitive answer either way.

提交回复
热议问题