-
Notifications
You must be signed in to change notification settings - Fork 20
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
Error: cannot uniquely infer foreach argument types #5
Comments
Hi @arjunadeltoso, Thanks for reporting this. The foreach is implemented using opApply with the following signature :
The key is required. For now, you'll need to implement your foreach loops as And yes, the doc should say |
Thanks for the reply, yeah wasn't sure if foreach(_, fruit; fruits)
writeln(fruit) was the correct approach or if I needed to overload |
That's correct. I've overloaded opApply in master to allow foreach without key declarations. I need to mull over making it into range before my next release. This one's a quick patch, but it closes the issue. I will close this ticket in my next release. And the docs are fixed. |
I have this code
it doesn't compile because of
Error: cannot uniquely infer foreach argument types
.I'm following the example at http://adilbaig.github.io/Tiny-Redis/
for(fruit; fruits) writeln(fruit);
and that also seems wrongly suggesting to use
for
instead offoreach
.The text was updated successfully, but these errors were encountered: