On Thu, 2002-04-11 at 01:40, Ian Macdonald wrote: > On Wed 03 Apr 2002 at 20:35:30 +0900, you wrote: > > > I've used eval in Ruby once: to build a Ruby browser that let us type and save > > single methods at a time, the way one does in Smalltalk. > > > > I believe that was a valid use. I can't think of another one. > > So what is a better way to do this? > > def each > self.instance_variables.each { |attr| yield(eval attr) } > end Sorry if it should be obvious, but what is the purpose of eval on attr? Also, that isn't in any way calling the parser, is it? (or is attr a string being sent to the parser?) If all you want to do is send a copy of each instance variable to a block, I wouldn't see why eval() is needed at all. > > Ian > -- > Ian Macdonald | Life does not begin at the moment of > ian / caliban.org | conception or the moment of birth. It > | begins when the kids leave home and the dog > | dies. > |