Hi -- On Thu, 4 Jan 2007, Robert Dober wrote: > On 1/3/07, dblack / wobblini.net <dblack / wobblini.net> wrote: >> >> Hi -- >> >> On Thu, 4 Jan 2007, Robert Dober wrote: >> >> > (2) OT but still interesting I feel it might be a good convention that >> any >> > method changing the object should have a ! suffix, would make >> > programs much more readable, don't you think? >> >> No. I would not want to see pop turned into pop! or << turned into >> <<! and so forth. > > > You are right especially for operators <<!, looks terrible but would be > necessary if one wanted to follow the rationale. > I feel it would be nice to have it, but I agree such a paradigm change > cannot take place anymore in a mature language. > > All that said I really like the idea of seeing in a method call if an object > changes or not, look for example at C++, the information is in the > declaration "const" would it not be much better in the usage, e.g. in the > method call? You can generally tell from the semantics of the method name. For example, Array#pop has no possible non-destructive meaning. (A non-destructive pop would just be array[-1] with an incomprehensible name.) There are a couple of cases where you do have to learn it... like the fact that Array#delete is destructive but String#delete isn't. Similarly, if you follow the "dangerous" idea, you can infer that gsub! is a destructive gsub, since that's pretty much the only "dangerous" thing a gsub operation can do. > Coming back to Tom's idea of do! vs do, to be consistent we would need a {! > vs {, no? and we are not talking methods anymore. > > So #send! and do! ? maybe not. do isn't a method, though; it's a keyword. I don't think we're going to get (or want) ! on keywords. David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)