-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
how to handle rest
with invalid state argument?
#15440
Comments
Probably better use a name which is common in other languages. Would you make a short survey? |
Shouldn't iterating on |
@nalimilan I think this might be julia specific, python and java do not allow this and mandate the use of @yuyichao This behaviour is only possible in specific cases. In general you cannot test if a certain state is ever reached from an iterator. |
Isn't the interpretation of the iterator state meant to be an entirely private matter to the type being iterated over? This function strikes me as dangerous, as it encourages people to make assumptions about such implementation details, which might actually change at any time. Perhaps there are good reasons that make it needed in |
I can see this being useful when you are calling |
Yes, we're assuming the state is valid. It's definitely a general issue, e.g. UTF-8 string indexes come to mind. I don't see anything we can do about it without a performance disaster. |
However, we could have a function to check whether a state is valid, and call it when constructing a |
But would it be a performance disaster to limit the usage to |
rest
of an iterator is a misnomerrest
with invalid state argument?
Datapoint: In @samoconnor called the same functionality in #14805 "resume" |
Yes.
The function isn't dangerous. Passing hand constructed Is there anything in the documentation to suggest that constructing a |
Yes, and I like a name derived from "resume" because that conveys the notion better that the argument is a state which was obtained earlier using legal means. |
There doesn't seem to be enough clarity on what (if anything) to do here for this to make 0.6. |
As the
rest
of an iterator can contain more elements then the original one, e.g.maybe
from(iter, state)
would be a better name.The text was updated successfully, but these errors were encountered: