You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is not possible because the argument signatures are the same.
But would it be interesting to be able to do this?
Using "super"loaded method definitions above, one could then do the following elsewhere:
var x:String = Test.test("qsdf")
The explicit variable type can be used to infer which overloaded method to take.
P.S.: I think this would be pretty cool to have and would allow to write easier-to-use and easier-to-write API's, but if it goes against some design principles in Scala, please correct me as I'm not a Scala pro.
The text was updated successfully, but these errors were encountered:
For example,
object Test {
def test(a: String):Int = {
return 1
}
def test(a: String):String = {
return "1"
}
}
is not possible because the argument signatures are the same.
But would it be interesting to be able to do this?
Using "super"loaded method definitions above, one could then do the following elsewhere:
var x:String = Test.test("qsdf")
The explicit variable type can be used to infer which overloaded method to take.
P.S.: I think this would be pretty cool to have and would allow to write easier-to-use and easier-to-write API's, but if it goes against some design principles in Scala, please correct me as I'm not a Scala pro.
The text was updated successfully, but these errors were encountered: