That is an important root insight. It also applies to for loops, and could apply to switch statements
switch result { case something: break case none: error: empty: default: //? }
Values are much easier to reason about and inspect than functions, so it's better to have simple functions that return complicated values than to complicate the functions themselves.
And you know this how?
> Values are much easier to reason about and inspect than functions
Right, which is why we want to avoid functions as much as possible.
> simple functions that return complicated values than to complicate the functions themselves
Fortunately, these filters aren't functions, so this doesn't complicate them, it makes them simpler.
Professional experience.
> Fortunately, these filters aren't functions, so this doesn't complicate them, it makes them simpler.
Functions are at least restricted enough that you can sort of reason about them. If these things are not even functions then there's no hope of ever understanding them.
You can then centralize the error handling by having a "stderr"-like output on your filters.
When you have a call/return architectural style, you need to return something, and thread the result along, making things more complicated.