Go rant

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Dec 19 19:29:45 PST 2009


dsimcha wrote:
> == Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s
>> "This code is shown for its elegance rather than its efficiency. Using
>> ++ in this way is not generally considered good programming practice."
>> So if the code is inefficient and in poor programming practice, how in
>> this blessed world could it count as elegant?
> 
> Because most functional programming purists (or, to avoid singling out functional
> programming, purists of any single paradigm) are theory weenies.  These people
> usually don't know an L2 cache from a floating point unit.  They wouldn't grok
> things like implementation efficiency (as opposed to algorithmic/asymptotic
> efficiency) or close to the metal concepts if they were hit smack in the head with
> them.  Thus, they live in paradigm land and work with theoretical models instead
> of real-world code.

That argument doesn't hold because qsort has quadratic complexity (which 
is a theoretical thing) for a large category of inputs. Theory also has 
demonstrated that the correct choice is to randomize the pivot. So I 
don't buy it that qsort has any merit, theoretical or practical.

I think the qsort example does a lot of damage to the FP community. It's 
just lousy every way you look at it, and consider this:

1. FP has a crushing superiority compared to all other paradigms.

2. An FP expert could choose ANY example to illustrate said crushing 
superiority.

3. Is qsort it?


Andrei



More information about the Digitalmars-d mailing list