http://www.perlmonks.org?node_id=825712


in reply to Immutabillity and scope and temporary objects

-- Blog post; wankerish:

...there is usually not more than one good way to do something...

I see that and start to lose interest in anything that follows. This is a One True rant (in this case, supporting functional programming) and I immediately discount by half anything else the author has got to say.

One True people are slaves to their One True Thing, be it the One True God, the One True Politico-Socioeconomic Model, or the One True Programming Paradigm.

...(with pure being the key word, not functional)...

This raises my absolutism flag. Compared to the average postmodern deconstructuralist, I'm a pretty absolute guy; but I still say the solution has to fit the exercise, not the reverse.

There are no absolute rules in programming; there is no One True Paradigm.

That said, there is much merit in splitting work into scopes. I agree that some data is per-request and should be stored in a temporary object. Assuming you're running a persistent environment like mod_perl, then yes, there will be considerable data that never changes and might as well be stored in an immutable object.

But then, I say there may be plenty of data that changes slowly and yet needs to be stored: per-session data, perhaps. A mutable object is reasonable here. Just don't get sucked into the One True trap.