Allow the sink underscore as placeholders for optional arguments. #7562
Unanswered
EskeRahn
asked this question in
Language Ideas
Replies: 2 comments 11 replies
-
Beta Was this translation helpful? Give feedback.
10 replies
-
The way I handle this in my code is to make all of my optional parameters nullable and default them to null. Then I coalesce them In the method body to their defaults. This way default always gets me the default parameter value instead of the default type value. This approach is also nice because it allows me to implement default parameter values for complex types and classes |
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.
-
Let us assume we have some (odd) function with multiple optional parameters
This can currently be called using the sink placeholder, e.g. with
But what about also allowing using the underscore as a placeholder for selecting the default for the parameter?
if there are multiple calls to the same function next to each other it is easier to read, as you do not have to remember the names.
Beta Was this translation helpful? Give feedback.
All reactions