Julien Ponge
Julien Ponge
No idea why it was closed, must have been a bad clic
/cc @michalszynkiewicz
Thanks @gavinking, this is a good set of thoughts. I see where you are going, what you want is a clean separation between: 1. value-transforming operations, possibly accepting a `Supplier`...
BTW @gavinking could you please point me to some snippets where these API changes would help? I'm not necessarily interested in all, just 1-2 relevant ones. Thanks!
I had tried that as well a while back, but it was quite intrusive and breaking. Let's revisit.
How about generalising `ifNull / ifNotNull` with `when(predicate)`? `uni.onItem().when(user -> !user.hasValidEmail()).failWith(() -> new IllegalArgumentException("bad email"));`
I wouldn't deprecate `ifNull` / `ifNotNull` since they are very useful, I would just have a more general purpose `when`, `if`, whatever predicate group for all the other branching cases.
And then perhaps we could refactor `ifNull` and `ifNotNull` with that
@markusdlugi is this something you'd want to try to contribute? (up to you, don't worry)
No worries 👍