[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: s-exprs + prototypes




On Tuesday, June 24, 2003, at 10:48  AM, Christopher Barber wrote:

>> At the moment, imperative programmers use mutation without thinking 
>> about
>> it, and they've mostly never learned any other way to program.  Most 
>> use of
>> mutation is gratuitous, and simply arises from the design of 
>> imperative
>> languages which actively encourage & require it.  I don't think 
>> eliminating
>> these uses of mutation is in any way fundamentally difficult for 
>> humans, as
>> long as languages provide constructs that support basic features like
>> iteration and recursion in ways that are comfortable to use.
>
> I disagree.  Not allowing objects to have mutable state would weaken 
> the object
> metaphor to the point where the average programmer would find it hard 
> to grasp.
> The way humans perceive the real world, objects can and do have 
> mutable state.

I think that many functional programmers (myself included) believe that 
functional
programs are easier to reason about because they may easily be 
understood as the
composition of many separate pieces.  That is, when I want to 
understand the behavior
of an object receiving a message in a world with mutable state, I must 
consider
all possible states of the object.  If this object refers to other 
objects, I'm really stuck.
A purely functional call, however, depends only on its inputs.

There's a reason that mathematics is mathematical. I think that computer
programming should take this approach as well.

john clements