Prev: Thread error "undefined method `keys' for nil:NilClass"
Next: Getting version from PE executables
From: Walton Hoops on 8 Nov 2009 13:49 > -----Original Message----- > From: bascule(a)gmail.com [mailto:bascule(a)gmail.com] On Behalf Of Tony > To reiterate from my previous message, because the behavior of Numerics > is already a special case to begin with. How? Because they are immutable? That's not special casing, that's just how the class is designed. I can write an immutable class in Ruby, without any special casing.
From: Rick DeNatale on 8 Nov 2009 13:50 On Sun, Nov 8, 2009 at 1:18 PM, Tony Arcieri <tony(a)medioh.com> wrote: > On Sun, Nov 8, 2009 at 10:45 AM, Rick DeNatale <rick.denatale(a)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)
From: Tony Arcieri on 8 Nov 2009 14:13 [Note: parts of this message were removed to make it a legal post.] On Sun, Nov 8, 2009 at 11:50 AM, Rick DeNatale <rick.denatale(a)gmail.com>wrote: > 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. > But the rebinding is being done by an operator, not a method, and there's ample precedent for operators that perform rebinding in Ruby (=, +=, -=, /=, etc) -- Tony Arcieri Medioh/Nagravision
From: Seebs on 8 Nov 2009 14:13 On 2009-11-08, Tony Arcieri <tony(a)medioh.com> wrote: > You still seem to be missing what I'm proposing. > For Numerics, ++ would rebind. For everything else, it would be dispatched > as a message. > Am I being unclear? I don't think that gives the right semantics in many cases. It's also not clear that rebinding works: array_example.length++ What should this do? -s -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Seebs on 8 Nov 2009 14:14
On 2009-11-08, Tony Arcieri <tony(a)medioh.com> wrote: > But the rebinding is being done by an operator, not a method, and there's > ample precedent for operators that perform rebinding in Ruby (=, +=, -=, /=, > etc) And which of those operators special-case Numeric? Any of them? I don't think so. If it's to be a rebinding operator, it ought to rebind for everything, not just for numerics. -s -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated! |