Hacker News new | ask | show | jobs
by distortedsignal 1494 days ago
Having worked with erlang for some time now, https://www.erlang.org/eeps/eep-0049 is _very exciting_ to me. One of the issues that I have with the codebase that I'm in is deep nesting, which could be solved with this feature. Very compelling.

(HN mods: feel free to delete this comment or my comment at https://news.ycombinator.com/item?id=31426002, since they're the same content)

1 comments

This is great. I hope this finds its way to Elixir land.
It is already there with the "with" macro.

The EEP doc calls it out:

https://www.erlang.org/eeps/eep-0049#elixir

"This is the most general control flow in this document, being fully flexible with regards to which values it can handle. This was done in part because there is not a strong norm regarding error or valid values in either the Erlang nor Elixir APIs, at least compared to other languages here.

This high level of flexibility has been criticized in some instances as being a bit confusing: it is possible for users to make error-only flows, success-only flows, mixed flows, and consequently the ˋelseˋ clause can become convoluted."

This already exist with the `with` expression, no?
Yeah, `with` is pretty much this.