Scripsit ille aut illa Rando Christensen <rando / babblica.net>: > Tue, 26 Nov 2002 06:30:36 +0900: Daniel Carrera (Daniel Carrera > <dcarrera / math.umd.edu>): > > > > 9. Ruby has no pre/post increment/decrement operator. For instance, > > > x++ or x-- will fail to parse. > > > > Why is that? x++ and x-- are very convenient. I sort of understand > > why++x and --x don't exist. But why can't numbers have a "++" and > > "--" method? > > I don't see it as that big of a deal. "very convenient"? How > about "marginally convenient"? Really, how much more convenient is this: > > x++ > > over this? > > x += 1 > > By my count, it's two spaces, a shift key, and an extra character. 100%. In C++, for example, I mostly prefer ++i over i++ because i++ works slightly differently (it saves the value of i, increases i by one and returns the saved value). Whenever I write "i++", I use the feature that i is "first returned, then incremented". Example: a[i++] = 'h'; a[i++] = 'e'; a[i++] = 'l'; a[i++] = 'l'; a[i++] = 'o'; ++i and i+=1 are semantically the same, but i++ and i+=1 aren't. i++ is roughly equivalent to (i+=1)-1. But as already written: the worst thing is that "++x" doesn't cause an error, only a warning. -- [mpg123d] Just playing: .../albums/shamrock/14 lookin' for love.mp3 A remarkable, elegant little C function was written to implement I-TAG processing, but it has too many lines of code to include in this margin [11]. RFC 2795