[erlang-questions] Reassigning variables
Wed Mar 18 06:35:28 CET 2009
On Tue, Mar 17, 2009 at 8:52 PM, Richard O'Keefe <> wrote:
> Fair enough. The ?let macro would have precisely the same
> advantage, with no parse transform required.
Not entirely. The ?let macro requires adding an extra close
parenthesis at the end of the block. It's still an improvement over
having to modify a bunch of lines of code, but it's still extra lines
of changes that I'd rather avoid.
> If you care about readability, you should be. I find non-trivial
> case expressions in Erlang almost totally unreadable with the
> semicolons on the right. In C/C++/Java/C#, you have 'case' at the
> beginning of a line to tell you when a new case begins. In Ada,
> you have 'when'. In PL/I, you have 'WHEN'. The same kind of thing
> applies in Fortran. Something on the left to tell you a new choice
> is beginning is enormously helpful. Erlang-with-semicolons-on-the-
> right completely lacks that visual cue.
In Erlang, there's indentation to indicate where the start of each
clause is. It mimics natural languages somewhat more of using white
space to separate paragraphs and punctuation to end and separate
paragraphs. However, I can appreciate your arguments.
> "Bombinating in a vacuum" is bootless.
> We need REAL code to discuss.
I'd prefer not to post the actual code that motivated this discussion,
but I will point out some code in OTP that uses numbered variables:
the Erlang compiler. It uses them quite significantly, with some
:~/src/otp_src_R12B-5/lib/compiler/src$ for x in `jot 11
0`; do echo -n "St$x: "; cat *.erl | grep -c
v3_core.erl is especially heavy in numbered St variables.
sys_core_dsetel.erl also likes to use numbered Env variables.
Now, I'll concede that the Erlang compiler has been relatively stable,
but looking at the diffs between releases, I do still see instances of
changes necessitating non-local renumbering.
I'm interested to know how you'd suggest rewriting v3_core:lc_tq/5
More information about the erlang-questions