Binding vars inside `cond`?

Guys, first thank you for so many responses and edifying ideas! It’s really enlightening to read through them. I respond to some here

The one thing I am not so happy about in this approach is that it “disperses” the flow. If one looks at else if/elsif/elif etc. in other languages it is clear what the steps are. Similar can be achieved in Elixir with cond and with but the limitations are more strict here. I’d prefer to keep this one-look flow overview intact.

iWow!™ - that looks geeky enough to elevate my heartbeat rate :slight_smile: and it allows wrapping only the expensive call(s). Looks like a good “solution candidate” to me!

Right, but no, they are heterogenous and returning whatever pleases them. As for the anti-pattern in some particular cases, I wouldn’t care that much (something I expressed here) yet here this doesn’t apply, and adding annotations or whatever to make it work smells from half a mile away :wink: Wrapping all things and normalising returns would work well but this we know.

True. Although it looks like a bit of an overkill for the case at hand, doesn’t it?

O! That’s an interesting “abuse” of the with construct. For the current case it should in fact work as none of the errors evaluates to true. OTOH as mentioned already it can be brittle in the longer run. And you yourself mentioned you wouldn’t prefer it over nested constructs. Thanks for the enlightenment regardless!