From: David Abrahams (dave_at_[hidden])
Date: 2006-07-06 01:15:45
Jody Hagins <jody-boost-011304_at_[hidden]> writes:
> Joel, I am really interested to know why you prefer the functional
> approach in C++, a language which offers both options.
>> Me, I prefer the immutable and functional approach:
> Blech. What are the overwhelming reasons for having purely immutable
> interfaces in C++?
In C++ or any language, functional interfaces tend to make code
clearer, for the same reason that "const" is valuable. When values
associated with names change, it is usually harder to keep track of
what those names mean.
Of course, when immutability starts to interfere with expressive
power, it can have the opposite effect, but I have learned to prefer
immutability until it proves impractical.
Also, it's worth noting that immutable types tend to be more amenable
to efficient parallelization, so mutability is not necessarily an
-- Dave Abrahams Boost Consulting www.boost-consulting.com