From: Zach Dennis Date: 2004-08-24T23:48:36+09:00 Subject: Re: *with* block? Thanks everyone who replied....I like the instance_eval solution, although I think it would be nice if *with* were on a Object level, like Jamis Buck first posted... class Object def with( obj , &block ) obj.instance_eval &block end end class Test def initialize @x = 5 end def x return x end end t = Test.new with t do puts @x x = 35 @x = 35 end puts t.x I think the *with* block acts as expected as far as instance variables and local variables are conerned. When you initialize an object you have to specify the '@' or 'self.' before the variable name. So it makes sense that in the *block* it would be treated the same. I think it is so much cleaner to say: with obj do ... end rather then: obj.instance_eval do end I guess there isn't a huge difference and I might just be being picky, but I totally think the *with* block is a much cleaner solution. Zach