From: Gregory Seidman Date: 2006-03-29T01:07:49+09:00 Subject: Re: Why do some methods names which replace the content in place doesn't have the "!" sign? On Tue, Mar 28, 2006 at 11:22:31PM +0900, Peter Hickman wrote: } Michael Ulm wrote: [...] } >It would if you knew C++. This is actually one of the more useful } >features of C++. If a method is declared 'const', the compiler ensures } >that it does not modify the instance variables of the object (unless you } >use really deep magic). This can be quite useful when debugging. } } I program in C++ (and Java and Perl) but fail to see how a feature from } a statically typed language would provide any benefit to a dynamic } language such as Ruby. Without even trying to work out how you would } hope to graft it on. I have never wanted for such a feature in Ruby but } I have wanted features from Ruby in other languages. There are many valuable features that are orthogonal to whether typing is static or dynamic. One example is OO. The const-ness of an object is a typing issue, but duck-typing is still typing. When I call a method on an object, I am asking it to respond to a particular message with a particular set of arguments (which are part of the definition of the message). If it doesn't, it is not "a duck." If I ask an object to respond to a particular message, and included in that message is an argument that is const, the object is only "a duck" if it can accept and use that argument without modifying it. } >I hope the condescending tone here was an accident. You too don't know } >everything (see above), and you too make mistakes (see above). } } I was cutting to the chase. I have read too many posts from people who } have only read a couple of articles on Ruby and think that they can fix } by making it more like C++, C, Java, Python, Perl, Visual Basic or } whatever they think they understand. Inexperienced programmers seem to } have a love of languages with many arcane and complex rules and when } they don't find them they get all flustered and try and fix things } rather than try and understand how we could possibly develop anything } without them. The original poster may not have a perfect grasp of English, and therefore his expression of his ideas was imperfect. Nonetheless, his suggestions were interesting and could lead to worthwhile idioms, if not features, in Ruby. Your dismissiveness helps no one. --Greg