[erlang-questions] Local namespaces in case/try
Sergei Lebedev
superbobry@REDACTED
Tue Jul 10 11:40:17 CEST 2012
Richard,
While this indeed *may* be a sign of a problem in your code, for the original example this is hardly the case. Splitting the function apart *only* because of compiler limitations sounds like an ad-hoc hack, not a real solution.
-- Sergei
On Jul 10, 2012, at 1:02 PM, Richard Carlsson wrote:
> On 07/10/2012 10:43 AM, Dmitry Groshev wrote:
>> case do_something() of
>> {ok, Result} -> Result;
>> {error, Error} -> Error
>> end,
>> case do_another() of
>> {ok, Result} -> Result;
>> {error, Error} -> Error
>> end,
>>
>> 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.
>
> Take it as a sign that you should break out those case expressions into separate functions, or restructure the code in some other way.
>
> /Richard
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list