From: Tony Arcieri Date: 2010-02-09T04:30:15+09:00 Subject: Re: Why no ++ and --? --000e0cdf0f4c10434b047f1bd45c Content-Type: text/plain; charset=ISO-8859-1 On Mon, Feb 8, 2010 at 12:20 PM, Seebs wrote: > You can't increment the underlying object, because fixnums are immutable. > Not to beat the dead horse any more but... In a language like Ruby where the binding operates entirely by reference, it would only make sense for the ++ operator to change which object a variable name references (i.e. destructive assignment) as opposed to sending a message which actually mutates the object it references, especially since ++ is an operator intended to work with numbers and Ruby's numbers are immutable. Using x++ as a shorthand for: begin; _tmp = x; x += 1; _tmp; end ...would be the only sensible implementation. There exists an operator in Ruby which doesn't send a message: =. The "=" operator modifies the binding. ++ (and --) would have to do the same. Unprecedented? Yes. But not impossible. -- Tony Arcieri Medioh! A Kudelski Brand --000e0cdf0f4c10434b047f1bd45c--