[erlang-questions] (no subject)

Andras Georgy Bekes bekesa@REDACTED
Tue Mar 11 16:32:47 CET 2008


> I just find that the following style:
>
> { ... args needed ... } = compound statement,
> use args
>
> advertises the programmer's intent much more clearly.  It states that
> the compound statement is being executed for the side effect of
> binding a particular set of variables.  This binding environment is
> necessary for the following statements.
I agree, this style is in most cases much better.
I tend to use it when I want to bind few names, and I use the other when 
I bind more. When binding like more than 3 names, writing a >3-tuple 
everywhere is less readable than binding the names in each of the 
branches of cases, ifs or receives.

However, there is a case when binding values in each case gets 
problematic: when you throw an exception in some of the cases, but bind 
names in others. Although you know your function will stop executing in 
some cases and not binding the names is no problem, the compiler will 
complain even if it can see the literal throw/1 calls.

	Georgy



More information about the erlang-questions mailing list