--000e0cdf0f4c10434b047f1bd45c
Content-Type: text/plain; charset=ISO-8859-1
On Mon, Feb 8, 2010 at 12:20 PM, Seebs <usenet-nospam / seebs.net> 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 + ; _tmp; end
...would be the only sensible implementation.
There exists an operator in Ruby which doesn't send a message: The "