------=_Part_17232_10310181.1143550228856
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hi --
I'm all for revolutionary moods, but I'm afraid that makes no sense at
all
Makes a lot of sense to me (seriously!!!)
Instance variables are the object's business. When you call a method,
you shouldn't even have to know whether instance variables are
involved. Also, ! means "dangerous", and there's nothing inherently
Please define "dangerous", I do not have the most remote idea what might be
dangerous, apart
of modifying state, which is "modifying instance variable".
dangerous about methods that use instance variables.
I do not want to change Ruby, but the basic idea to have a clear syntactic
definition of what is "read only" access and what is "write" access seems
very appealing to me.
Please try to get out of the Ruby paradigm for that *theoretical*
discussion.
So tell my why it is a bad idea, if you think it is a bad idea.
It does not make sense, is not a reason, BTW
I will tell you why it is a good idea.
* 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.
* 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.
* The third reason is that I always felt unsure of !,? and =3D at the end o=
f
method names
Try to use this method
class Bad; def a=3D; puts "very bad"; end; end
So "!", "?" do not have the same kind of impact than "=3D", not too much
orthogonal, is it?
Enforcement (late but never theless ) of "=3D" is already "rubyish", why
should "!" (or "?", please see below) not be?
* Other, much less important reasons, include ease for tools, analyzers and
just beacause it would make the language more expressive.
I always found there should be a class Boolean in Ruby with
class Boolean < Object...
class TrueClass < Boolean ...
class FalseClass < Boolean
than we could e.g. assure that
a method ending in ? would return a Boolean.
Of course other syntactic measures could be taken, but ! just seems fine fo=
r
right now.
Maybe nobody wants this in Ruby, still I think it is a good idea to think
about concepts like this.
Cheers
Robert
--
David A. Black (
[email protected])
Ruby Power and Light, LLC (
http://www.rubypowerandlight.com)
"Ruby for Rails" chapters now available
from Manning Early Access Program!
http://www.manning.com/books/black
--
Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.
- Albert Einstein
------=_Part_17232_10310181.1143550228856--