From: Tony Arcieri Date: 2010-02-17T01:49:41+09:00 Subject: Re: Why no ++ and --? --000e0cd3546e4fbbea047fba6aac Content-Type: text/plain; charset=ISO-8859-1 On Tue, Feb 16, 2010 at 1:28 AM, lith wrote: > I find that issue interesting in a slightly different perspective. > Shouldn't it be possible to implement that operator right in ruby and > doesn't it point to a shortcoming that there is no way to implement it > (other than using a decorator). > ++ and -- modify their receivers. Since Ruby's Numeric types are immutable, they cannot be modified. So the only solution is to implement ++ and -- as assignment operators. Immutability certainly isn't a shortcoming, in fact it's very much a good thing, especially when concurrency is involved. My own pet programming language has no mutable state whatsoever and implements all operators that modify their receivers as assignments. -- Tony Arcieri Medioh! A Kudelski Brand --000e0cd3546e4fbbea047fba6aac--