From: Gregory Seidman Date: 2006-03-29T21:42:29+09:00 Subject: Re: Why do some methods names which replace the content in place doesn't have the "!" sign? On Wed, Mar 29, 2006 at 05:50:30PM +0900, Peter Hickman wrote: [...] } Fine, now say how this is supposed to be of benefit to Ruby. What does } it make doing in Ruby easier and safer than the present way we go about } doing it? [...] } This is my point, there was no "sufficiently compelling and clear } argument" given other than it is available in C++. I don't know that it is of great benefit to Ruby, honestly. I certainly found it valuable in C++, but that had a lot to do with a need to provide libraries with as much in the way of machine-readable documentation (e.g. I promise I won't delete this object you are passing me) as possible given that I knew the consumers of the library wouldn't read anything I wrote about it. There are certainly advantages to design-by-contract, of which const is a special case. I'd like to see some machine-readable guarantees of preconditions and postconditions and invariants and the like in Ruby. Such guarantees are both debugging aids and optimization hints. For a language like Ruby, where many of its uses are quick scripts, an actual requirement to put such guarantees in one's code would be a problem. Optional hints and assertions are easy, however. In any language, including Ruby, it is possible to assert preconditions and postconditions. Invariants are somewhat more difficult without runtime support. What makes a language truly support design-by-contract is that these assertions mean something specific to the runtime beyond code to be executed. No, I can't come up with a Ruby implementation off the cuff. It is an interesting idea that someone could run with, however, and it is for that reason that I objected to your stifling dismissiveness. If you look back at my posts, you will notice that I never defended const, or enforcing any particular meaning for the ! method suffix. I regarded the original poster's ideas as interesting, and worth discussing. --Greg