Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-10-20 19:39:03

"Peter Dimov" <pdimov_at_[hidden]> wrote in message
> Thorsten Ottosen wrote:

> > My point was that (most) verbs in the imperative means mutation,
> > nothing else. I expect
> > mutation to happen in those cases. I also expect a function called
> > remove() to mutate the input and
> > I consider a different behavior very strange.
> In this specific case, I don't expect or want mutation by default; strings
> are logically much closer to immutable values than they're to stateful
> objects, and string operations in most languages reflect that.

As I said in my other post:

php: trim() does not modify the original.
python: strip() does not modify the original
java: trim() : does not modify the original ( even though it's a member
function; there's no equivalent in StringBuffer )
eiffel: prune() : mutates (member function)
perl: chomp: mutates

I wouldn't say all languages agree. In java you can actually get the this
pointer in some cases, so you will end up
referencing the original. Some of the languages are probably not powerful
enough to do what Pavol tried to do, so
their design seems more like a *coincidence*, not a design.


Boost list run by bdawes at, gregod at, cpdaniel at, john at