[erlang-questions] erl_tidy options
Dale Harvey
harveyd@REDACTED
Fri Jul 24 21:27:00 CEST 2009
2009/7/24 Cláudio Amaral <coa@REDACTED>
> Hi all!
>
> I am exploring the syntax tools provided by Erlang and I can't see the real
> purpose of erl_tidy and I can't understand the purpose of the options.
>
> For example, what is the gain of the transformation at the end of the
> compiling process?
> Ex - {auto_export_vars, true} option
> {X, Y} = case ... of
> ... -> {17, foo()};
> ... -> {42, bar()}
> end
>
> to
> case ... of
> ... -> X = 17, Y = foo(), {X, Y};
> ... -> X = 42, Y = bar(), {X, Y}
> end
>
That I dont like, in fact I almost wish erlang didnt allow
exporting variables from case, its almost always less
readable imo
>
> Or the option {auto_list_comp, true}, rewriting calls to lists:map/2 and
> lists:filter/2 to list comprehensions.
>
This I do agree with though, list comprehensions are almost
always shorter and more readable than map and filter
lists:filter(fun(X) when X rem 2 =:= 0 -> true; (_) -> false end,
lists:seq(0,10)).
vs
[ X || X <- lists:seq(0, 10), X rem 2 =:= 0 ].
I dont think I have seen any case for map / filter that are more readables
than list comprehensions(once you get over the initial scare of the list
comprehension syntax).
>
> Thanks,
> Cláudio Amaral.
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>
More information about the erlang-questions
mailing list