[erlang-questions] erlang sucks
Ulf Wiger (TN/EAB)
ulf.wiger@REDACTED
Tue Mar 11 21:32:15 CET 2008
attila.rajmund.nohl@REDACTED skrev:
>
> There's one more thing that sometimes drive me nuts - due to the lack of
> decent 'if' statement, new functions are written instead of branches of
> a conditional statement. So I see a lot of code like this:
> do_something(X, Y) ->
> really_do_something(X, Y).
>
> really_do_something(a, Y) ->
> really_really_do_something(a, Y);
> ...
>
> really_really_do_something(a, b) ->
> ... % could be a one liner
>
> The problem is that the really_really_do_something is way to long to
> type for people whose editor can't complete function names, so they'll
> write rrds instead - which is very non-intuitive. I've just checked and
> our code contains more than 150 functions with 3 character name, more
> than 50 functions with 2 character name and more than 150 functions with
> 4 character name. Some of these names actually make sense (e.g. get,
> set), but most of them do not - and I don't like function names that do
> not make sense. I haven't seen this practice in C++ or Java projects.
One very good reason for doing this(*) is that Erlang has excellent
trace facilities for function calls, but no ability to trace on
branching. I tend to agree that it often leads to less readable
code, but I don't agree that it's because of 'if' - at least not
in the cases where I've observed it in our code.
(*) this = using many small functions - not using illegible function
names, which is just silly.
BR,
Ulf W
More information about the erlang-questions
mailing list