From: "Brian Schröder" Date: 2005-07-30T18:13:43+09:00 Subject: Re: make local var visible On 30/07/05, "Pe�a, Botp" wrote: > William James [mailto:w_a_x_man@yahoo.com] wrote: > > #You say that you are converting Perl code, which is usually full of > #$'s and @'s, so this probably looks no worse than what you would > #have converted it from: > # > #$x=1 > # > #def mx1 > # p $x > #end > # > #mx1 > #p $x > # > #def mx2 > # $x = 2 > # p $x > #end > # > #mx2 > #p $x > # > # > > not worse, but bad nonetheless. I already told them that they do not need > the dollar, and now i'm asking it back. And the dollars look like snakes > too. > > I'm using constants notation for now, the code looks funny with variable > standing out. I guess funny is better than bad. > > thanks and kind regards -botp > Hello botp, if you just want to convert them one to one without rethinking I don't think it's worth the effort. Why not stick with what works? But if you are refaktoring them on the way and OO-ing them at the same time, then you don't need weird constructs like leaking locals. As was mentioned before. Make a class with attribute accessors, encapsulate state nicely and refactor your methods sensibly then it may be a good step to move to ruby from perl. Please don't let the force of bad design overwhelm you, regards. Brian -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/