On Saturday 30 August 2008 13:11:38 Erik Hollensbe wrote:
> David Masover wrote:
> > Why not add a ++ that works the same way += does?

> 1++ would have to operate (essentially) like 1.succ!

Except 1++ wouldn't work, any more than 1 += 1 would work.

Again, the suggestion was that it work the same way += does -- and += doesn't 
rely on a .succ! method of any kind. It would be purely syntactic sugar, the 
way +=.

In other words, it would still parse to:

foo = foo + 1

Or, maybe slightly better, it would parse to:

foo = foo.succ

it would just be shorter to write than

foo += 1



The immutability of integers is a good thing for people to know, yes.
It's also completely irrelevant to this discussion.

And for the record, I'm playing devil's advocate -- the real issue seems to be 
that ++ would add to the parsing complexity of it. I'm guessing most of us 
rarely do +=1, so most of us wouldn't really use it, so it's not worth that 
complexity.

But it's by no means impossible, or a fundamental change to the language.
All it does is make the parser more complex.