Hi --

On Tue, 4 Dec 2007, MonkeeSage wrote:

> On Dec 4, 3:02 am, "David A. Black" <dbl... / rubypal.com> wrote:
>
>> 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.

> 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.).

> * 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.


David

-- 
Upcoming training by David A. Black/Ruby Power and Light, LLC:
    * Intro to Rails, London, UK, December 3-6 (by Skills Matter)
See http://www.rubypal.com for details and 2008 announcements!