Hi --
>> They inherently change their receivers, but that's a separate matter
>> from the !.
> Well...99% of the time it is, except when the ! only serves to
> indicate that it operates in-place (String#reverse!, Hash#update!, and
> probably a few others I can't think of offhand*). That's why I
> characterized the ! as "either-or-both" regarding in-place/dangerous.
I'm not sure I follow, so this may not be relevant, but in-place
changes (changes to the receiver) are one form of "danger", in this
sense. They're just not the only form.
Don't mind me, I'm just over-analyzing.
After remaking that
"danger" can be ambiguous above, I posted a characterization of !
where I tried to disambiguate "danger" in the following way: "Causes
some side-effect that is incompatible or sufficiently different from
the non-bang version". Since everything is "dangerous" in ruby from
the perspective of a haskeller, I thought it might be helpful to
differentiate between mutation of the receiver (not generally
considered dangerous in ruby), and incompatible/unexpected behavior as
compared to the non-bang version. Most bang-methods, I think, do both.
> Even if it's not a good idea or breaks with the common usage, it is
> used that way at least a few times in stdlib.
I don't know of any that don't come in pairs, where the ! one
indicates "danger" (reverse/reverse!, exit/exit!, etc.).
I agree. That was one of my reasons for not supporting "push!" --
along with the fact that the method name is fully descriptive, and
that a ! suffix would be confusing, it would be unbalanced (q.v.,
previous post).
> * Oh yeah, and I just remembered #power! (on Bignum I think) which
> isn't dangerous and doesn't modify the receiver...it just raises to a
> power. Where the heck did the bang come from?!
Good question. I see this in ri but I don't see it actually on any
objects. I'm not sure what it is.
It appears to be an alias of an alias (power! -> ** -> rpower).
Bignum#rpower returns a new Rational, so, indeed, the operation is non-
dangerous and does not mutate the receiver...I guess matz just had an
extra "!" lying around and didn't want to waste it, heh. 
David
--
Upcoming training by David A. Black/Ruby Power and Light, LLC:
* Intro to Rails, London, UK, December 3-6 (by Skills Matter)
Seehttp://www.rubypal.comfor details and 2008 announcements!
Regards,
Jordan
···
On Dec 4, 7:00 am, "David A. Black" <dbl...@rubypal.com> wrote:
On Tue, 4 Dec 2007, MonkeeSage wrote:
> On Dec 4, 3:02 am, "David A. Black" <dbl...@rubypal.com> wrote: