On 05/11/2009, at 1:31 AM, Marnen Laibow-Koser wrote:
> I believe you are quite wrong.  If a destructive function like gsub!  
> can
> be implemented as a method, then I see no reason that +=, |=, or  
> postfix
> ++ couldn't be.

It can be done, if you are willing to make your numbers mutable:

class MutableNum
   def initialize n
     @n = n
   end

   def pp
     @n += 1
     @n - 1
   end

   def method_missing symbol, *args
     @n.method(symbol).call(*args)
   end

   def to_s
     @n.to_s
   end
end

a = MutableNum.new 1
puts a.pp #=> 1
puts a  #=> 2

Having said that, I agree with others that the post-increment operator  
is not needed in Ruby at all.

--
Tobias Cohen
http://tobiascohen.com/