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

Order of predicate and lambda in recoverWhen #7

Closed
kwisatz opened this issue Nov 11, 2019 · 2 comments · Fixed by #8
Closed

Order of predicate and lambda in recoverWhen #7

kwisatz opened this issue Nov 11, 2019 · 2 comments · Fixed by #8

Comments

@kwisatz
Copy link
Member

kwisatz commented Nov 11, 2019

The order of evaluation of predicate and lambda (first lambda, then predicate) in recoverWhen has tricked me several times. While this can make sense (e.g. to check that applying some algorithm on a given value returns the expected result before continuing), I feel like we could also profit from a function that first runs the predicate (on this.value or this.error, see #6) and only then run the lambda function.

@floriansimon1
Copy link
Collaborator

This is a bug. We should probably call the predicate before the lambda. Would that break a lot of your code?

@kwisatz
Copy link
Member Author

kwisatz commented Nov 11, 2019

Me personally, I know of just a single occurrence that would be easily fixed. And I just grepped through THE project and there's not a single occurrence of recoverWhen. So the answer is probably no.

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