----- Original Message -----
From: "Pe?a, Botp" <botp / delmonte-phil.com>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Sunday, December 08, 2002 8:14 PM
Subject: [YANQ] -yet another (ruby) newbie question -string#concat


> My YANQotd is regarding string#concat. A sample code and output would be
> good to illustrate:

[snip]

> I noticed that concat modified fn. I looked for other concat methods but
> couldn't find one (but the + op). I was hoping that there would be a
concat!
> and concat pair (like chop!/chop and chomp!/chomp).
>
> Maybe string#concat! was deprecated for "+"? My concern is that (as a
> newbie), I'm trying to avoid methods with "!" (like chomp!/chop!) so I
have
> less to worry/know. My strategy was working and I was actually coding w
> breeze... until I bump.. :-(

I think that the operation "concatenation" can be
viewed in two ways.

The first (as I would tend to view it) is a simple
operation that takes two operands and gives a result
(same as +).

The other is an operation *on* a certain object (like
append). This is how String#concat works; it is an
append operation.

Note that this is almost as much as question of English
usage (IMO) as of computer science.

If strings were immutable, there would be no question
of what is meant here; but they are mutable.

As for avoiding the "!" methods... I wouldn't suggest
that. Do what works for you, but I would suggest just
learning the two ways of thinking and using each when
appropriate. I.e., "Should I modify the original object
or make a new one?"

Just my thoughts.

Hal