You mean it’s useless because the Erlang compiler will generate the same BEAM code for both examples?
I would be interested in (real-world) examples where the Erlang compiler is unable to do that optimization. If we could improve the Erlang compiler to generate better code for nested cases it would benefit the entire BEAM community.
In Erlang/OTP 26, it sufficient to enable the maybe
feature in the compiler. There is no longer any need to enable it in the runtime system too for it to work. We realized that we had to do that so that we could use maybe
in OTP code.