FAQ terminology harmonisation

Matthias Lang matthias@REDACTED
Thu Apr 3 21:18:46 CEST 2003

Rick Pettit writes:

 > Agreed. Out of curiousity, if you were to write a C/C++ application
 > (I know, it's too gruesome to think about), would you follow the 
 > same strategy? That is, would you NOT check for NULL, etc, in cases
 > where you just should not be passed NULL? How about in an
 > application comprised of distinct processes in a chain which 
 > could die and be reborn without the entire application crashing?

not checking for "NULL" isn't quite the same as the usual erlang
approach. The usual erlang approach is to use pattern matching to
force an abort in many cases where something unexpected happens, e.g.

   {ok, S} = gen_tcp:connect(Host, Port, Options),

you can't really write that naturally in C, I find myself forever

   sock = connect(...);

Is that defensive programming? Not really, IMO. PERL has an idiom
which is somewhat like Erlang, btw: f() || die


More information about the erlang-questions mailing list