Matching elements of records
Jouni Rynö
Jouni.Ryno@REDACTED
Thu Oct 28 07:44:00 CEST 2004
Those, who have had exposure to C, at some point, might get to a habit
of writing if-statements like this (against all the instincts)
if {0 == TestVariable} {
foo
}
Once looking long enough for mistakes like this
if {TestVariable = 0} {
foo
}
one learns to change the coding style. Others may know better and change
to Erlang.
If I remember correctly, a recent linux-kernel trojan was implemented
with such a misuse of the if-statement, just to hide from a casual
reader.
regards
Jouni
P.S Does the left-right rule work on the arabic etc. right to left
written language areas?
On Thu, 2004-10-28 at 16:35 +1300, Richard A. O'Keefe wrote:
> variable on the left automatically ensures that the "heavy" component,
> the branching component, is on the right.
>
> Somehow
> f(X = {a,b,c,d})
> looks right, while
> f({a,b,c,d} = X)
> looks as though "=" was a misprint for ",".
>
> Until we have some experimental evidence about readability in Erlang,
> we'll have to put this down as a matter of taste, but there _is_ the
> evidence from natural language that variable on the left might be
> more readable, so it hardly makes "no sense" to recommend what we have
> reason to believe is more readable.
>
--
Jouni Rynö mailto://Jouni.Ryno@fmi.fi/
http://www.geo.fmi.fi/~ryno/
Finnish Meteorological Institute http://www.fmi.fi/
Space Research http://www.geo.fmi.fi/
P.O.BOX 503 Tel (+358)-9-19294656
FIN-00101 Helsinki FAX (+358)-9-19294603
Finland priv-GSM (+358)-50-5302903
"It's just zeros and ones, it cannot be hard"
More information about the erlang-questions
mailing list