On Wed, 29 Nov 2000, Dave Thomas wrote:

> 
> gsub! and sub! give information that's fairly expensive to determine

But we could introduce sub? -- takes same args as sub! but doesn't change
anything, returns true if sub would change anything, false otherwise...
This would be less expensive than making the changes in a copy [it would
not make the copy or the changes], since as soon as one change was found
the thing could stop.  Similarly for sort?, gsub?, reverse?, rather than
checking afterwards....
   
> any other way when they return nil. reverse! and sort! don't.
> 
> I'd vote for an end to the convention.
> 

Yes.  Sometimes it's worth breaking old code.  Not very
often though! 

I think if a function needs to return a status and
the receiver, then it should return an array, so you
can at least do

foo.sort![0].uniq!

But this is much less elegant than having "will this be
changed?" operators.   ISTR being taught that functions
that have side-effects are generally a bad thing, so 
I would see the removal of this as a step forwards.

It is about the only thing I don't like about Ruby.

If I see this 'nil sometimes' thing as a flaw, then it is an
understandable, human, one; and I intend no disrespect to Matz in putting
my point forward strongly.

> 
> Regards
> 
> Dave
> 
> 
	Thank you,
	Hugh