-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
implement RFC-402 #18618
implement RFC-402 #18618
Conversation
The error msg is not matched with the previous behaviour. |
can the last param be checked specially so that we allow optional params with an untyped body: when defined case6:
template fn(a = 1, b = 2, body) = discard
fn(1, 2):
foo1
foo2
fn(1): # bug: doesn't work
foo1
foo2 |
# Check if the argument count match with the parameter count, | ||
# if doesn't match, fail fast | ||
# See https://github.com/nim-lang/RFCs/issues/402 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add tests to ensure this works and at least doesnt' introduce regressions
things to consider:
- varags[int]
- varags[untyped]
- optional params
etc
You can define another overloaded template or using macro with varargs[untyped]. |
Making default arguments work with untyped bodies sounds like it should be part of a completely seperate RFC. Possibly combined with named only arguments support as a pragma or a new postfix operator so it doesn't break existing code. |
Is there anything to do here besides test for |
This pull request has been automatically marked as stale because it has not had recent activity. If you think it is still a valid PR, please rebase it on the latest devel; otherwise it will be closed. Thank you for your contributions. |
nim-lang/RFCs#402