On July 19, 2003 07:32 pm, Tim Hunter wrote:
> Personally I don't use x++ even in C. My reason? Changing the value of a
> variable is important enough that we should spend some visual weight on
> it, and x++ doesn't deliver as much impact in code as x += 1. (I think of
> it as having more pixels, or ink.)
>
> There's only one place I use x++, and that's in the 3rd expression in a
> for statement. It's a common C idiom and doing anything different would be
> confusing.

As for me, I use it all over, but:
1) I only ever use it as the 3rd argument of a for loop or on a line by 
itself, and never assign the result of it to anything
2) I only ever use it for integers, never for pointers or anything where it's 
not 100% clear that what's happening is that a number is going up by one.

In fact, whenever I'm porting/editing code someone else has written I always 
remove any potentially confusing pre/post increment operators as I go.

> As for the pre-increment and both flavors of decrement, forget it. The
> pre- and post-increment/decrement operators are only there because the
> machines on which C originally ran had INC and DEC machine instructions
> and it was easy to get the compiler to generate them. They're a remnant of
> the old days.

Well for me, because I only ever use it as a complete, isolated expression, I 
could use either pre-increment or post-increment and be happy.

But, having said that, I really like using them in those really isolated ways.  
To me "i++" and "i += 1" are very different.  One is incrementing the number 
i, the other is adding i and 1 then assigning the value of that addition to 
i.  Now those all boil down to the same thing, but from years of using i++, 
whenever I see i += 1 I have to look at it carefully before I am convinced 
that it's just incrementing a number.

I'm not convinced that Ruby should change to suit my idiosyncracies.  If i++ 
becomes available, I'll use it happily.  If it doesn't, I'll learn to be 
happy with i += 1.

Ben