Randy Kramer
3/3/2005 1:08:00 PM
On Thursday 03 March 2005 04:54 am, Brian Schröder wrote:
> So a ++ operation would mean change 5 to be 6. And that would be quite
> inconsistent:
> Numbers: 1,2,3,4,5,6,7....
> 5++
> Numbers: 1,2,3,4,6,6,7...
Five introductory remarks: I dislike the ++ operator in C, etc., I don't like
the Perl TIMTOWTDI philosophy (makes it too hard for me to read Perl code,
especially since I gave up on learning Perl), and I don't know how I talked
myself into attempting to learn Ruby which has sometimes been described, in
some sense, as somewhat Perl like, and I'm too much of a newbie in Ruby to
think of the right (best) examples, and I'm not specifically responding to
Brian--I've seen similar answeres to this question a few times on the list,
but:
Doesn't Ruby somewhat pride itself on doing the intuitive thing, sometimes
including (for example) more than one syntax for the same thing to make it
more intuitive for newbies (like the ability to write a "normal looking" for
statement instead of requring the something.each syntax)?
Aren't there other cases somewhat like that--iiuc, a string is normally
mutable but you force it to be non-mutable (with, IIUC, the ! to make
destructive operations (if I have the terminology right)?
Is the "++" syntax used for some other operation, thus precluding its use for
a synonym for increment. And wouldn't the right thing for ++ be to increment
to the next number?
So why did I write this (and, will I press send? clearly, if you're reading
this I did press send)? Am I just ranting? Maybe. Do I really want "++"
added to the Ruby syntax? No, absolutely not!
Ok, maybe I have to go back to one of the statements attributed to Matz,
something like (paraphrased from memory): "I have tried to make Ruby
intuitive for me, I hope it is intuitive for others as well, but" he seems to
make no promises (iirc).
So, maybe I'm trying to come up with another explanation for why "++" will not
be supported in Ruby (with no sarcasm/disrepect intended), and maybe there
are at least two: One is the one mentioned above, that in the existing and
preferred (consistent) syntax of Ruby, ++ woud be interpreted as attempting
to change the object 5 to the object 6, and Matz's world view doesn't see
enough value in the == syntax to make it an exception. (100% fine by me, by
the way.)
So, again, shall I press send? Yes, I think so. I think the extra perspective
of knowing there is a person (at least nominally) in charge who has made a
conscious decision will let me (in my own mind) set the issue to rest. (That
is ignoring all the discussion I see (is that on a different list?) about
requests to change, among other things, the syntax of Ruby.
sorry for the noise,
Randy Kramer