We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
proc myProc(x = 0) = discard myProc x=1 # error: undeclared identifier: 'x'
The text was updated successfully, but these errors were encountered:
It only works when the first argument is unnamed.
proc foo(a, b: int) = echo a + b foo 4, b = 5 # 9
Sorry, something went wrong.
IIUC it's because of precedence rules, look at
import macros macro deb(a): untyped = echo a.treeRepr echo a.repr deb: myProc x=1
StmtList Asgn Command Ident "myProc" Ident "x" IntLit 1 myProc x = 1
EDIT: looks like a common gotcha, see this recent post: https://forum.nim-lang.org/t/8037
the question is: how can we improve things here without introducing parser ambiguties?
on possible rule is:
myProc x = 1 # still parsed as (myProc x) = 1 myProc x = 1, expr # previously rejected by parser, now accepted as myProc(x = 1, expr)
which does not sound ambiguous
=
Successfully merging a pull request may close this issue.
Example
Additional Information
The text was updated successfully, but these errors were encountered: