[erlang-questions] Local namespaces in case/try

Dmitry Groshev <>
Tue Jul 10 10:43:49 CEST 2012

Is there any reason why we don't have them? It's quite annoying to
have potential error in places like this:

case do_something() of
    {ok, Result} -> Result;
    {error, Error} -> Error
case do_another() of
    {ok, Result} -> Result;
    {error, Error} -> Error

Result and Error are bound in first case and we will probably have a
match failure in second one. Compiler warns about this, but it's still
very unwieldy to fix it with names like Error1, Error2, etc. I also
earnestly ask to avoid answers like "you should name that variables in
a meaningful way so there is no such problem".
Speaking about backward compatibility: first, I think it's a very bad
style to use variables that was bound this way and second, there is
nothing wrong in introducing one more compile-time option (like inline

More information about the erlang-questions mailing list