On Tue, Mar 28, 2006 at 10:23:21PM +0900, Peter Hickman wrote: } Robert Dober wrote: [...] } Methods have nothing to do with "read only" and "write" access. I don't } know where you got this concept from but it is clearly confusing you, } discard the concept, it is hindering your understanding of what Ruby is } actually doing. } } >* The first and most important reason is a practical one How great for } >debugging and maintenance of code, you will never have to examine } >methods not ending with ! if you are searching for the reason of some } >strange value. Look at a C++ developper, she will never have to look } >into methods declared with "const", and do you really think Ruby should } >be outclassed by C++? And it would be much better than in C++ because } >the information is conveyed at declaration and at usage. } } This doesn't make the slightest bit of sense to me. Have you programmed in C++? There is a great deal of value to the idea of const instances of objects which only allow const methods to be called on them. I'm not claiming that Ruby should necessarily support such a thing, but I can certainly understand the desire for it. } >* The second reason is that this is only the surface of the iceberg It } >will be a revolutonary concept, think about classes. Only classes with } >names ending in "!" can be subclassed. Or classes not ending with "!" } >will become unmodifiable as Java::String or python::string There are for } >sure much more ideas, and much better ideas, that will spring into the } >mind of much more informed people than your humble servant. } } Ruby is a dynamic language, thus you can change classes. In fact is it a } very powerful concept (revolutionary even). If you want B&D then go ahead } and use Java (by the way you can modify unmodifiable Java Strings) but } the reason that people like Ruby is that they can get things done without } the language getting in the way. I'm inclined to agree with this. In addition, if you *really* need a class that can't be changed you can freeze it; preventing subclassing can be done by making the class's inherited method throw an exception. It's possible, but probably undesirable. Note that there is absolutely nothing revolutionary about Ruby, except possibly some of the software being written in it. Ruby is an excellent implementation of a lot of good programming language ideas (reflection/introspection, message sending, anonymous blocks, OOP, mixins, dynamic typing, etc.), but there is nothing genuinely new about it. } >* The third reason is that I always felt unsure of !,? and = at the end } >of method names Try to use this method class Bad; def a=; puts "very } >bad"; end; end So "!", "?" do not have the same kind of impact than "=", } >not too much orthogonal, is it? } > } >Enforcement (late but never theless ) of "=" is already "rubyish", why } >should "!" (or "?", please see below) not be? } } I was going to answer this and your other points but frankly I get the } impression that you don't know enough about programming to understand the } answers. A lot of the converts to Ruby are programmers with many years } experience who found, like myself, that they could get the job done in } Ruby much easier than the various languages that they had been using for } years. That was the revolutionary concept and you seem to have missed it } completely. There is no reason to be insulting. It is not unreasonable to expect various non-alphanumeric characters at the end of a method name to mean something to the parser, particularly when one of them (equals) actually does. Furthermore, the question mark has a pretty clear semantic meaning, and almost all ruby code adheres to the convention well. The bang (!), however, is used inconsistently. Its primary value seems to be distinguishing between methods that produce the same result, but the one without the bang produces the result in a returned copy whereas the version with the bang modifies the receiver to take on the resulting value before returning itself. Other uses muddy the waters, including the distinction between save() and save!() in ActiveRecord models. So we call it "dangerous" and define this vaguely to mean whatever the API author considers dangerous. I consider the availability of the bang as an allowed character in a method name a noble, but largely failed, experiment. --Greg