-
Notifications
You must be signed in to change notification settings - Fork 23
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
Exporting a toSeq
overload messes up iterator visibility
#512
Comments
That's because overloaded procs need to have the same |
Having a Wouldn't it be possible to solve the issue by avoiding an Also I struggle to find the documented limitation and I still can't make sense of the error message here. Apparently the overloading resolution seems to pick the right version of |
Certainly.
Because it doesn't pick up the right overload. |
Then we should probably go for a Edit: Oh haha, I cannot re-open :). |
In fact even the standard library violates the "don't accidentally export a import sequtils, tables, nre
let t = initOrderedTable[int, int]()
let s = toSeq(keys(t)) I'm afraid the (current?) limitations of inline iterators make a proper solution very tough :-(. |
I know. |
just hit this bug again;
no, unfortunately with the way iterators are implemented in the compiler today, I don't think it's possible to have a |
I think the proposal is to have various overloads of |
This issue has been automatically marked as stale because it has not had recent activity. If you think it is still a valid issue, write a comment below; otherwise it will be closed. Thank you for your contributions. |
i don't see how this can work without a compiler change; the problem is the
for reference, the bug is when toSeq requires an untyped param: when true:
import sequtils
# import nre # uncomment would give: Error: attempting to call routine: 'foo'
iterator foo(n: int): int =
for i in 0..<n: yield i
echo toSeq(1..2)
echo toSeq([1,2])
echo toSeq(foo(3)) # this is the case broken by `import nre`
|
Compiling
main.nim
results in:Error: attempting to call undeclared routine: 'keys'
. Basically none of the iterators fromtables
can be used in atoSeq
context when another module (accidentally) exports an overload oftoSeq
.The text was updated successfully, but these errors were encountered: