From: dblack@... Date: 2007-01-13T07:58:23+09:00 Subject: Re: RCR again (Integer#succ!, Integer#pred!) Hi -- On Sat, 13 Jan 2007, Phrogz wrote: > dbl...@wobblini.net wrote: >> Even when it's 2007++ integers will still be immutable, immediate >> values :-) I much prefer having people have to learn that that's how >> Ruby integers are. > > To be fair, that's a perfectly reasonable argument if ++ were to be a > method call. If it's to be programmer convenience for x += 1 (syntax > sugar for x=x+1) however, it could also be implemented as syntax sugar. > > I'm personally perfectly happy without ++, but there are certainly ways > that it *could* be added to Ruby without violating the immutable > objects. I don't think that's ever been in doubt (that the parser could be trained to turn x++ into x += 1). But the reason Matz has always given for not considering it appropriate is that in languages where it's used it customarily indicates incrementation, rather than reassignment to a variable. So using it for assignment would potentially be misleading. David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)