Re: [Fwd: Re: Functional Programming in the Larger or Functional Oriented Software Engineering]
Matthias Felleisen <[email protected]> Fri, 30 Mar 2007 07:20:58 -0400
| Newsgroups | gmane.comp.lang.lightweight |
|---|---|
| Message-ID | <[email protected]> |
On Mar 30, 2007, at 2:32 AM, Matthew Swank wrote: > 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. Garbage collectors are much better with short-lived objects (on the average) than with old stuff. They can collect it. The lack of proper program design in the OO community that got its hands on Java seems to require a lot more research on GC so that it jives with their ill-conceived notion that object-oriented programming is assignment plus some silly features for encapsulation, which every LL programmer knows are unnecessary anyway. -- Matthias