Re: Why do some methods names which replace the content in place doesn't have the "!" sign?
- From: Peter Hickman <peter@xxxxxxxxxxxxx>
- Date: Wed, 29 Mar 2006 01:37:29 +0900
Gregory Seidman wrote:
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.
Fine. Firstly explain how having const methods in Ruby would enhance the language, that is to say how is would help do something in Ruby easier and safer than the current version of Ruby, then (for bonus points) explain how it could be implemented. Just because a feature exists in another language does not mean that it is /missing/ from Ruby. I like abstract methods in Java but I do not think that they are missing from Ruby and their absence has not caused me any problems. What makes a language a good language in my book is not a feature list of every conceivable paradigm but a clear underlying philosophy that is simple to grasp, this means that a good language will probably not have some features that are in other languages. Lua does not include integers! Imagine that, a language without integers. We must fix that at once!!
Lets not fall into the trap of penis envy here. Ruby does not need a whole bunch of features added to it just because some other language has them.
The original poster may not have a perfect grasp of English, and thereforeThe posters command of English was not an issue and even he did not use it as an excuse but what he did not explain (and I believe that his command of English is up to the task) is why these features were lacking from Ruby. 'Other languages have them' is not good enough.
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.
.
- References:
- Why do some methods names which replace the content in place doesn't have the "!" sign?
- From: Eric Boucher
- Re: Why do some methods names which replace the content in place doesn't have the "!" sign?
- From: dblack
- Re: Why do some methods names which replace the content in place doesn't have the "!" sign?
- From: Robert Dober
- Re: Why do some methods names which replace the content in place doesn't have the "!" sign?
- From: dblack
- Re: Why do some methods names which replace the content in place doesn't have the "!" sign?
- From: Robert Dober
- Re: Why do some methods names which replace the content in place doesn't have the "!" sign?
- From: Peter Hickman
- Re: Why do some methods names which replace the content in place doesn't have the "!" sign?
- From: Michael Ulm
- Re: Why do some methods names which replace the content in place doesn't have the "!" sign?
- From: Peter Hickman
- Re: Why do some methods names which replace the content in place doesn't have the "!" sign?
- From: Gregory Seidman
- Why do some methods names which replace the content in place doesn't have the "!" sign?
- Prev by Date: Playing sounds on a Mac
- Next by Date: Re: Why do some methods names which replace the content in place doesn't have the "!" sign?
- Previous by thread: Re: Why do some methods names which replace the content in place doesn't have the "!" sign?
- Next by thread: input without blocking
- Index(es):
Relevant Pages
|