On Saturday, July 19, 2003, at 02:11  PM, Mark J. Reed wrote:
> However, to address the specific example, I would just use 
> each_with_index:
>

Right, but my point was that I didn't really want to touch the iterator 
because the index part was just a temporary hack to get some debugging 
info.  The goal was to change the code in such a way that when I found 
the source of the problem I could nuke a few lines and the code would 
be the same as before.  Aside from the ease of "ctrl-k" or "dd" 
(depending on your editor), it also makes it easier to spot the change 
if you do a diff against the original.

It was a weak attempt to come up with a situation where x += 1 was 
useful.  Any other times when it is handy?  I use iterators all the 
time, but I also find myself using x += 1 all the time (though offhand 
I don't remember when).

I'm on the fence about x++.  I use it all the time in other languages, 
and it would save some keystrokes when I wanted to do the equivalent 
thing in Ruby.  I agree it could cause problems if someone tried to do 
0xDEAD++, but 1) it should be easy to write a parser to catch that and 
2) someone who does that is really odd and deserves whatever they get.  
On the other hand, right now if you are modifying an object, the method 
either has an equal sign in it, or has a bang in it.  This would be yet 
another special case.  Maybe instead Fixnum should have a #succ! method?

Ben