Skip to content
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

drop methods don't pass value to Iterator while dropping #113

Closed
avandolder opened this issue Jul 16, 2020 · 2 comments · Fixed by #194
Closed

drop methods don't pass value to Iterator while dropping #113

avandolder opened this issue Jul 16, 2020 · 2 comments · Fixed by #194

Comments

@avandolder
Copy link
Contributor

i'm a bit confused why this needs a lastValue instead of calling with the parameter absent. why would the next method need to have arguments.length be 0 for the dropped cases, but 1 for the kept ones?

(in other words, why aren't they all passing undefined to IteratorStep?)

Originally posted by @ljharb in #112

The current behaviour of the drop methods is observably different for dropped calls to IteratorStep/Next and non-dropped ones. It seems desirable to unify them; either pass through lastValue to the iterator on all steps, even the dropped ones, or don't pass it at all.

@avandolder avandolder changed the title i'm a bit confused why this needs a lastValue instead of calling with the parameter absent. why would the next method need to have arguments.length be 0 for the dropped cases, but 1 for the kept ones? drop methods don't pass value to Iterator while dropping Jul 16, 2020
@devsnek
Copy link
Member

devsnek commented Jul 16, 2020

it was done that way on purpose (drop and then it behaves like map v => v), but I wouldn't be opposed to not passing it at all.

@bakkot
Copy link
Collaborator

bakkot commented Jul 7, 2022

As of #194 none of the helpers ever pass an argument to .next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants