-
-
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
_ (underscore) is not ignored inside templates #13804
Comments
What's the use case though? Your example should use |
template foo =
let (_, a, b) = (3, 4, 5) warns when unpacking a tuple |
When 2 " #No compile error
let (_, _, x) = (1, 2, 3)
echo x
template test() =
#Error: redefinition of '_`gensym3387051'; previous declaration here: f:\temp\testTU.nim(5, 8)
let (_, _, x) = (1, 2, 3)
echo x
test() |
Just ran into this bug again, but in a different way. Not only do templates not ignore template foo(_: int) =
for _ in 1..3: # Error: identifier expected, but found '4'
echo "hello"
foo(4) |
It can be used inside procs too. proc main(_: int) = echo _ |
Fixing #13443 should fix second part (although should still be tested) so don't need to specifically fix it yet. Edit: This might not be true, |
fixes nim-lang#13443, fixes nim-lang#13804, refs nim-lang#21121
* underscores for routine parameters fixes nim-lang#13443, fixes nim-lang#13804, refs nim-lang#21121 * add changelog + more tests * support generics and ensure inferred lambdas work
* underscores for routine parameters fixes nim-lang#13443, fixes nim-lang#13804, refs nim-lang#21121 * add changelog + more tests * support generics and ensure inferred lambdas work
* underscores for routine parameters fixes nim-lang#13443, fixes nim-lang#13804, refs nim-lang#21121 * add changelog + more tests * support generics and ensure inferred lambdas work
Example
Current Output
Expected Output
doesn't warn or error, correctly does not gensym in the first case, and does not try to substitute in the second case
Workaround
The text was updated successfully, but these errors were encountered: