From: "David A. Black" Date: 2001-09-04T23:31:54+09:00 Subject: [ruby-talk:20869] Re: RCR: non-bang equivalent to []= Hello -- On Tue, 4 Sep 2001, Tobias Reif wrote: > Maybe: > > All methods that are bang (that are working with and possibly modifying > the original(s)) have an '!' appended to their name. > Where it makes sense, non-bang versions (that return a possibly > modifyied copy and don't touch the original) should be provided, whose > name doesn't have anthying appended. > Aside from code-breaking issues, I just don't go for: a.push!(123) nor for the idea that: a.push(123) doesn't push 123 onto a. push! is redundant, because ! is just one way (and, in Ruby, not even fully that, as documented) to indicate that a receiver is being changed. Some methods already have names that unambiguously indicate such change (push, delete, etc.). Unambiguousness obviously entails knowing what such things mean in the first place, but that's true of ! and everything else too. I know that the binary logic of !/not ! (or !/!! :-) has a certain symmetry to it, but I don't think that symmetry maps at all comfortably, at least in a universal way, onto the semantics of Ruby method-naming. David -- David Alan Black usually dblack@candle.superlink.net writing from dblack@saturn.superlink.net