Allow a method implementing an interface to take additional optional arguments #8552
Unanswered
crawfis
asked this question in
Language Ideas
Replies: 1 comment 1 reply
-
With how optional parameters are implemented that would require the compiler to emit that bridge method, just as you did. Given how often this has come up, I don't feel that writing that bridge method manually is an onerous task. Although an analyzer could offer to write it for you, or a source generator could also emit such a bridge method. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If I have a class that implements an interface, I can easily add more methods. One such method might take an additional parameter. The interface implementation would just call this with a default value. Seems like the interface is contractually fulfilled if I allow extra optional arguments, so surprised this wasn't allowed. Example, given the interface:
I would like to do:
Rather than:
Beta Was this translation helpful? Give feedback.
All reactions