Re: [Fwd: Re: Functional Programming in the Larger or Functional Oriented Software Engineering]

Matthew Swank <[email protected]> Fri, 30 Mar 2007 01:32:13 -0500
Newsgroups gmane.comp.lang.lightweight
Message-ID <[email protected]>
Carl Eastlund wrote:
> On 3/29/07, Matthew Swank <[email protected]> wrote:
>> What if resources aren't cheap, or I have to manage my own memory.  Is
>> avoiding mutation still practical?
>
> Off the top of my head: in many cases, those two restrictions may
> actually make immutable data structures more desirable, not less.
> More persistent data means less data copying and thus less time/space
> resources used.  And immutable data is an extra data invariant that
> can sometimes simplify memory management; I certainly don't see how it
> would complicate it.
>
> In the end, I think the impact of slim resources or restricted memory
> management options on the choice of mutable/immutable data will be
> very circumstance-dependent.  Even if I spent more time thinking about
> it, I would be hesitant to give a universal answer.  Nonetheless, I
> expect immutable data structures to win out in the analysis far more
> often than they are actually used.
>
This seems a little too pat. Many functional idioms create an abundance 
of short-lived objects, and in higher order idioms, like function 
composition, a "natural" way of delegating the responsibility of 
deallocating intermediate values eludes me.

Matt

-- 
"You do not really understand something unless you can explain it to your grandmother." - Albert Einstein.