Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overloaded methods with same argument signature #8714

Closed
scabug opened this issue Jul 10, 2014 · 1 comment
Closed

Allow overloaded methods with same argument signature #8714

scabug opened this issue Jul 10, 2014 · 1 comment

Comments

@scabug
Copy link

scabug commented Jul 10, 2014

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.

@scabug
Copy link
Author

scabug commented Jul 10, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8714?orig=1
Reporter: edwh (lukovnikov)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant