optimization of list comprehensions

Richard A. O'Keefe <>
Fri Mar 10 01:29:49 CET 2006

	   now, suppose i was a project manager, and some guy managed to write some 
	excellent C++ code that did just what i wanted, but he didn't use classes. the 
	code's not very snazzy, but fully readable. if i understand you correctly, you 
	consider that guy incomptetent, and i don't.

You have forgotten the word "appropriate".  If it was *appropriate* to
use classes and the guy didn't, he isn't a competent C++ programmer whatever
else he is competent at.  If an Erlang programmer fails to use funs
*appropriately*, he is not yet a competent Erlang programmer.

	it is perfectly possible to be highly competent in the domain,

domain competence is not language competence

	and write perfectly fine Erlang, *AND* never use funs (except
	when using mnesia of course).
If funs are not used when they are *appropriate*, then it isn't
"perfectly fine" Erlang.

That's not to deny,m nor have I ever denied, that there are designs
to implement in Erlang for which funs are not appropriate.

There is one compelling reason to believe that inability or reluctance
to use funs in Erlang code really *is* indicative of less competence
than one would wish.  Good programmers are *lazy* programmers; they
don't want to write more than they have to.  Good programmers are
*self-critical* programmers; they are aware that they make mistakes
and consciously adopt strategies to reduce the risk of mistake.
For functional languages, higher-order functions are both a way of
reducing the amount of code one writes AND a way of reducing the
risk of errors in data-structure-walking code.  So lazy self-critical
programmers quickly catch on to the idea of using higher-order functions
in Erlang just like they quickly catch on to the idea of using iterators
in C++STL or Java.

	> That's nice for you.  How about trying to convince others?
	   yeah, that's a good idea! but maybe trying to do so will cause me to be 
	flamed by some wierdo, waste a ton of my time, and bore everyone on the mailing 
	list to tears? so i'll give it a miss.
Do I scent an insult here?  Someone who criticises you politely is not
flaming.  Someone who disagrees with you is not necessarily a weirdo.
If you think that providing evidence for a belief you wish others to
adopt is wasting your time, that's up to you.

Remember, language features don't come free.
*Someone* has to design them.
*Someone* has to implement them.
*Someone* has to document them.
*Someone* has to revised training materials.
This is more effort than you might think, so it had better have a
high enough payoff.  If it is you doing all these things, then it's
entirely up to your judgement whether to do it.  If you are asking
other people to do them for you, you had better give them good reasons.

More information about the erlang-questions mailing list