Software bugs aren't inevitable

Michael Sparks ms at cerenity.org
Fri Sep 16 09:35:52 EDT 2005


Steven D'Aprano wrote:

> On Thu, 15 Sep 2005 18:07:28 +0100, phil hunt wrote:
>> On Thu, 15 Sep 2005 21:56:06 +1000, Steven D'Aprano
>> <steve at REMOVETHIScyber.com.au> wrote:
>>>
>>>Are you saying that the recursion done by "serious" languages is a fake?
>>>That it is actually implemented behind the scenes by iteration?
>>>
>>>It seems to me that if recursion and iteration produce "the exact same
>>>machine code", the argument for preferring recursion over iteration is
>>>gutted.
>> 
>> It seems to me that if a high level language and assembler produce
>> "the exact same machine code", the argument for preferring high
>> level languages is gutted.
>> 
>> Do you see the fallacy in your statement now?
> 
> Ah, yes, you got me on that one.
> 
> But there is a difference: writing assembly is *hard*, which is why we
> prefer not to do it. Are you suggesting that functional programming is
> significantly easier to do than declarative?
> 

But there is a difference: writing assembly is *hard*, which is why we
prefer not to do it. Are you suggesting that object oriented programming is
significantly easier to do than old style imperative?

(sorry, couldn't resist)

FWIW, IMO once you've learnt functional programming's idioms it certainly
can be easier and more natural. The problem is the tools that make things
like recursion efficient aren't available normally in mainstream languages
meaning that most people simply don't get the practice.

Essentially it's about expressiveness.

Think of it this way - we normally write left to write, however some
languages read up and down. Neither is inherently better or easier
than the other, but for some things *may* be more expressive. 

If you think about it being about choosing the most clear/expressive way to
describe an algorithm, the argument may become clearer. After all, the
recursive definition of some things is clearer than the non-recursive.


Michael.




More information about the Python-list mailing list