|
Boost : |
From: Jody Hagins (jody-boost-011304_at_[hidden])
Date: 2006-07-05 10:42:05
On Wed, 05 Jul 2006 22:01:55 +0800
Joel de Guzman <joel_at_[hidden]> wrote:
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:
>
> to_upper(to_lower(to_upper(rng)))
Blech. What are the overwhelming reasons for having purely immutable
interfaces in C++? If I had both mutable and immutable options
available to me, there is no way I'd use the above, unless there was a
very good reason.
In most cases, "++i" may not be much better that "i++" but I always
prefer "++i" unless I have a very good reason for the other option.
Sure, premature optimization is bad, but premature pessimization is
worse. If you have two readily available and similarly easy to use
interfaces, why would I want to use the one that incurs far more
overhead?
I assume you will answer that you'd prefer to only have the immutable
interface available, so, whay is that, particularly in C++?
> For the record, I don't like fat everything-but-the-kitchen-sink
> interface too. Same as I dislike mutating functions. Sorry, Jeff.
I'm not in favor of huge interfaces either. However, let's not forget
that just because a function is outside the class specification, does
not remove it from the class interface.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk