From: MonkeeSage Date: 2007-12-08T00:50:01+09:00 Subject: Re: Dynamic local vars On Dec 7, 8:33 am, Tim Hunter wrote: > Jordan Callicoat wrote: > > > Not so much like a C macro, but more like a C struct...you could...use > > a Struct ;) > > > V = Struct.new(:x, :y).new(nil, nil) > > > def bar > > V.x = 10 > > V.y = 20 > > end > > def foo > > bar > > puts V.x, V.y > > end > > > Regards, > > Jordan > > Of course the Struct is not actually allowing him to share data between > bar and foo. It's the global constant V that's doing that. > -- > Posted viahttp://www.ruby-forum.com/. Yeah. I thought it fit the desired behavior though, since it shortened the call to bar (as per desired behavior) and only adds four more chars ("V." twice) over the original example. Regards, Jordan