-
-
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
sigmatch: support optional params with last block arg(s) #18631
sigmatch: support optional params with last block arg(s) #18631
Conversation
Maybe one of your tests should check the >1 body passed case with a |
a1461ab
to
536a447
Compare
i was planning on supporting that in future work, but i've now done it, see tests |
Why would I want this? To make statement lists more ambiguous? |
I think I simply don't understand your example. Can you explain why you added |
For that matter, can you explain why you add |
because optional params are useful and using overloads instead causes known problems, see linked issues |
The implementation matches the RFC, the only minor gripe would be that you should extract the new search loop into a helper proc. Will comment on the RFC. |
645af28
to
c85ad28
Compare
done, PTAL |
ping @Araq , this is a big usability improvement; (and I've replied in nim-lang/RFCs#405 (comment) to your comment in RFC) |
This caused a regression reported on the forums: https://forum.nim-lang.org/t/8513 |
This could work properly with varargs if the matching algorithm matched the first non default argument that hasn't already been matched instead of working backwards like it does now. That way it wouldn't try to fill the varargs argument in the case where it should fill other non default arguments first. |
this PR solves a major pain point of optional params with last block arg(s)
fix nim-lang/RFCs#405
fix #884
fix #14346
ditto with multiple block args via do:
etc, see tests/misc/trfc405.nim