On Sun, Nov 8, 2009 at 1:18 PM, Tony Arcieri <tony / medioh.com> wrote: > On Sun, Nov 8, 2009 at 10:45 AM, Rick DeNatale <rick.denatale / gmail.com>wrote: > >> As Matz himself has pointed out in this thread, >> >> > >> > There's no way to modify local variables by sending message in Ruby. >> > >> > matz. >> >> Which is something I've said on this thread before (multiple times IIRC). >> >> This has nothing to do with whether or not the object bound to a >> variable is immutable, it has to do with how ruby variable bindings >> can and cannot be changed, and that is the whole point. >> > > You still seem to be missing what I'm proposing. > > For Numerics, ++ would rebind. ¨Βος εφεςωτθιξη εμσειτ χουμβε δισπατγθεδ > as a message. > > Am I being unclear? No, but you ARE missing the fact that the lack of being able to rebind a variable via a method has NOTHING to do with the class of the object which is currently bound to that variable. Since ruby variables aren't typed then the expansion of the syntactic sugar b = a++ to "rebind for Numerics and dispatch for everything else" would have to be something like if Number === a b, a = a, a.succ else #.... end But note that in order to add 1 to a number, we still need to dispatch a method whether that be succ, or + and if we are going to do that we might just as well expand b = a++ to b, a = a, a.succ no matter what a is currently bound to. Not that I think ++ is valuable enough to change the language. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale