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

Replace the "Done b" constructor in folds with "Stop"? #2720

Open
harendra-kumar opened this issue Feb 4, 2024 · 0 comments
Open

Replace the "Done b" constructor in folds with "Stop"? #2720

harendra-kumar opened this issue Feb 4, 2024 · 0 comments
Labels
api:breaking Incompatible with existing releases
Milestone

Comments

@harendra-kumar
Copy link
Member

harendra-kumar commented Feb 4, 2024

That is stop without returning a value and get the value by using final.

We need "Done b" in folds instead of "Stop" to know the termination without having to push the next input. We can potentially
change it to use a "Stop" constructor instead. With that we won't be able to know about the termination until we send the next element down the fold. And, in that case that last element would be unconsumed. This is similar to the "Stop" behavior on the stream side, where we don't know about the termination until we try to pull the next element. Also, with this we would be able to express "takeWhile" and "span" folds without an additional constructor which expresses the idea of not consuming the value. This also means that on "Stop" we will always have to call "final" to extract the fold result.

This will make the fold Step similar to Stream sans the "Yield" constructor.

This can also simplify the Scan Step and make it identical to the Stream Step.

@harendra-kumar harendra-kumar added the api:breaking Incompatible with existing releases label Feb 4, 2024
@harendra-kumar harendra-kumar added this to the 0.11.0 milestone Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:breaking Incompatible with existing releases
Projects
None yet
Development

No branches or pull requests

1 participant