by Fire-Dragon-DoL · 2y ago · 0 comments
The closest ruby way is:
result = DoStuff
return something if result.nil? # error, early exit
result = OtherStuff(result)
return something if result.nil? # error, early exit
No additional complexity. Otherwise usually it ends up just rewriting "programming".With pattern matching there are also some alternatives now.
I love curried functions by default, but if it's not the default, it never works out even in functional languages like Elixir. You need to have every developer (and new hired developer) pretty much on board with that and exclude every library that doesn't do this, or wrap it (huge burden).
Given those, I'd rather stick to what I wrote. Not my favorite, I loved my brief experience with Elm