Expansion of default parameters for overloaded methods #21108
Aonodensetsu
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As per the scala tour, multiple functions with default parameters would conflict and therefore are not supported. This is indeed correct in the example given, however it fails to capture more complex scenarios.
These two functions are not permitted per the current rules, however the compiler would be able to infer which to use based on the type of the first parameter.
This can already be faked by trait apply, but obviously is not a good practice.
I don't know how useful exactly this would be in practice for methods, but it would definitely find some use in constructors.
Beta Was this translation helpful? Give feedback.
All reactions