-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Make dropWhile in Stream and LazyList stack-safe #6608
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
Conversation
|
I'm happy to add to this PR with more overridden methods; I'm just not sure exactly which methods are needed atm |
9613f0b to
9250f0c
Compare
| object Test extends App { | ||
| // Should not overflow the stack | ||
| Iterator.iterate(LazyList.from(0))(_.dropWhile(_ => false)).drop(10000).next | ||
| Iterator.iterate( Stream.from(0))(_.dropWhile(_ => false)).drop(10000).next |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't check for stack safety well enough - need to ensure that head and tail get evaluated (for both LazyList and Stream)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although the actual problem Seth mentioned doesn't seem to manifest with LazyList anyway, it's good to check that it works
9250f0c to
17f77f1
Compare
|
@NthPortal I wonder if it's a valid test to check if a they use memory sharing. |
|
@javax-swing while they should do that, that feels to me like specifying an internal behaviour for no reason; maybe that's just me though |
Override `dropWhile` in `LinearSeqOps`. Remove redundant override for `dropWhile` in `List`.
17f77f1 to
1bbef85
Compare
|
ping @SethTisue |
|
Thanks, @NthPortal! |
Addresses at least part of @SethTisue's concern in scala/collection-strawman#197.