[erlang-questions] How about a new warning? Was: Re: trouble with erlang or erlang is a ghetto

Motiejus Jakštys <>
Thu Aug 4 09:50:48 CEST 2011


On Fri, Jul 29, 2011 at 11:45:21AM +1200, Richard O'Keefe wrote:
> One of the things criticised in the blog entry that we've been responding to was
> that
> 	{ok,Foo} = bar(...),
> 	{ok,Foo} = ugh(...)
> is too easy to write (when you really meant, say, Foo0, Foo1).

I usually remember all variable names in a function I am working on,
because functions are small (and easy to skim through in 0.3 sec).

Don't write functions with more than 15 to 20 lines of code. Split large
function into several smaller ones. Don't solve the problem by writing
long lines, remember?
http://www.erlang.se/doc/programming_rules.shtml#REF32141

This advice solved this problem for me. I re-use bound variables for
crash early reason, therefore would not like for anything to change in
the current behaviour.

Motiejus



More information about the erlang-questions mailing list