-
-
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
Improve passing parameters to macros as statement #741
Comments
This is because the macro is {.immediate.} |
That's sort of what this feature request would be: even if Ignoring that, even without {.immediate.} the compiler ignores the default values for the parameters which may be a useful feature to have. Or not. |
Well, we have plans to gradually phase out the need for The other proposal for special treatment of calls featuring both default and stmt params is something that have been considered and I agree that it seems quite intuitive for the user. It's even possible to allow default parameters to appear anywhere in the signature and the matching algorithm to work as a DFA (i.e. like a regular expression such as "a b? c"), but obviously this will be quite an unusual feature. |
Latest nim #head complains because I also tried removing
|
Nice feature, but not gonna happen anytime soon. Closing. |
## Summary Introduce a set (`codegenExprNodeKinds`) with all node kinds that can appear in *general* expression and statement contexts during the code generation phase. The set is then used to make the `case` statement in the main AST traversal procedures exhaustive (no more catch-all `else` branch). ## Details The set doesn't include node kinds (such as `nkExprColonExpr` or `nkElse`) that can only appear in nested contexts.
The following example:
shows several wrong things when compiled:
There are several things which could be improved:
stmt
orPNimNode
so that the implementor of the macro doesn't have to check himself for the proper type.body
since it is actually empty and the body is being passed as theb
parameter.The text was updated successfully, but these errors were encountered: