Skip to content

Allowing overloaded methods with default arguments? #48

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

Closed
DarkDimius opened this issue Mar 7, 2014 · 4 comments
Closed

Allowing overloaded methods with default arguments? #48

DarkDimius opened this issue Mar 7, 2014 · 4 comments

Comments

@DarkDimius
Copy link
Contributor

Honestly, I'm not sure if it deserves effort to be solved, but I've had been asked why is this disallowed.

I believe that specific line is here: https://github.com/lampepfl/dotty/pull/47/files#diff-2fe35c59082b97d7128120593f9ec2e7R129
see also https://stackoverflow.com/questions/4652095/why-does-the-scala-compiler-disallow-overloaded-methods-with-default-arguments

@retronym
Copy link
Member

retronym commented Mar 7, 2014

I'm also hoping to loosen the restriction in 2.12: https://issues.scala-lang.org/browse/SI-8161

@xeno-by
Copy link

xeno-by commented Mar 7, 2014

Right! I did remember that you've done something along these lines, but could find a pull request :)

@odersky
Copy link
Contributor

odersky commented Mar 8, 2014

I think Dotty should simply do what Scala 2.12/13 does in this respect. I do not have strong feelings about it, but am currently more doubtful than optimistic. Arguments against the change would be:

  1. We want to position default arguments as an alternative to overloaded methods, why would it be desirable to mix the two?

  2. Even if we do the change, we have not solved the issue, there will simply be some cases which now work but others which are still rejected.

  3. We'd pay for this with a complication of the spec and possibly of the implementation. In particular I am worried about interactions with varargs,

@DarkDimius
Copy link
Contributor Author

Closing that issue, as it seems that we have some kind of consensus.
If somebody whats to rise this question once again: feel free to reopen.

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

4 participants