3 ms·
Subsystem is too big of a boundary. GP and GGP are likely talking about function level - which is where I also experience this. Imagine a situation as simple a
by TeMPOraL 6y ago
Subsystem is too big of a boundary. GP and GGP are likely talking about function level - which is where I also experience this.
Imagine a situation as simple as:
foo = ComputeSomething()
Where ComputeSomething() is a complex operation, spread into multiple functions, with many points that can fail for various reasons. If a function four layers down the stack from ComputeSomething() reports an error, this means all three functions above it need to also pass it back as Result<T>, and if you try to avoid the if-else hell, it means the entire call graph under ComputeSomething() will need to be wired with a monadic interface that smartly doesn't execute functions when Result<T> is of Error type. All it does is make you zoom through the call graph doing nothing, just to simulate the default behavior of an exception bubbling up the call stack.
- jstimpfle 6y agoDo you have an actual example where you do something 4 layers down the call stack from a subsystem entry point and (only) the lowest level can fail, and furthermore fail in a way that all the layers up the call chain need to bubble up the error? Maybe that can be rewritten so the error occurs / is handled at a more suitable place? The most obvious idea is: instead of retrieving something 4 layers down, get the information first at the top level, and if there was no error push it down. I've stopped thinking that syntactic features can solve structural problems. That applies to algebraic types just as it applies to exceptions.