4 ms·
Side effects are not allowed in functional style programming. Exceptions are side effects, it doesn't matter whether they are checked or unchecked exceptions.
by breadwinner 1y ago
Side effects are not allowed in functional style programming. Exceptions are side effects, it doesn't matter whether they are checked or unchecked exceptions.
https://jessewarden.com/2021/07/why-functional-programmers-avoid-exceptions.html https://jessewarden.com/2021/07/why-functional-programmers-a...
While composing methods in stream style is convenient, methods that can throw exceptions warrant more careful coding, so convenience should not always be the priority.
- int_19h 1y agoExceptions are not side effects since no state mutation occurs. If you really want to see everything through the FP lens, exceptions are exactly like Result<T, E> with implicit do-notation.