From: Walton Hoops Date: 2009-11-09T05:54:40+09:00 Subject: Re: Ruby doesn't implement x++ for Fixnum's because ??? > -----Original Message----- > From: bascule@gmail.com [mailto:bascule@gmail.com] On Behalf Of Tony > No it didn't, that post created a new class called "FixNum" I apologize, you are correct that post defined a new class, due to a capitalization error, which was corrected a few posts down. The point is, yes indeed, numerics can be mutable. I could if I were so inclined write a String backed subclass of Numeric which represtend integers as Roman Numerals and was mutable, (or Fixnum backed if we're feeling boring). > And again, that's beside the point, which is to allow the expected "++" > semantics for immutable Numerics while also allowing in-place > incrementation > for other classes which may store a mutable value, such as counters > (whosebacking store may be a database, memcache, etc) But your missing the point that ++ is NOT expected. Not in Ruby. Ruby simply doesn't work that way. You talked about "operator rebinding", but you ignored the fact that ++ is nothing like those examples. a+= expands to a=a+. It's a simple syntaxtic sugar. a++ expands to... what? Nothing. There is no way you could expand puts foo(a++,b) and get the desired behavior. This discussion has gone on and on, and it's really quite pointless. There is no good reason to include ++ in Ruby, and every reason not to. No one can even agree on what they would expect a ++ operator to do when used "The Ruby Way", with C programmers expecting it to work like C, and the Rubyists expecting it to follow the Ruby way, with every operator being a method call on that object (NOT variable). So why introduce this operator into the language that would cause all this confusion, when all it will do is save a few C programmers a SINGLE line of code. 95% of the time it won't even do that, if they would learn and do things the Ruby way, rather than trying to write C code in Ruby.