From: Robert Klemme Date: 2009-08-13T18:31:05+09:00 Subject: Re: Background on why Ruby doesn't support ++ 2009/8/13 Shajith Chacko : > On Wed, Aug 12, 2009 at 11:20 PM, Adam Lauper wrote: >> Anyone know the history on this deliberate omission? > > Matz addressed this in ruby-talk 2710: > > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/2710 Basically it is a consequence of the decision to make integers immutable which makes assignment necessary for a variable which is incremented. I guess Matz wanted to make this explicit, hence "+=" Co. Otherwise you need a counter class, e.g. Counter = Struct.new :value do def initialize(x = 0) self.value = x end def plusplus self.value += 1 end alias incr plusplus def minusminus self.value += 1 end alias decr minusminus end :-) Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/