On Tue, Aug 24, 2004 at 11:15:26AM +0900, David A. Black wrote: > > my_obj = boxWidget.new > > my_obj.instance_eval do > > @x = 0 > > @y = 10 > > @width = 100 > > @height = 100 > > end > > > > Though doing so will make you code fairly fragile - setting variables in > > sub(/fairly/,"extremely") :-) There's absolutely no guarantee of a > one-to-one correspondence between instance variables and setter/getter > methods -- and the way those methods are implemented could even change > from one release of a library to another. If the following syntax is acceptable my_obj.with do x = 0 y = 10 width = 100 height = 100 _ end you can make it 'setter-safe' (i.e. go through the normal attribute setters instead of bypassing them and assigning to the iv.s directly) trivially with Kernel#local_variables. You'll have to make sure you are introducing new variables (not reusing the ones from the outer scope) though, since otherwise there's no way to know which locals you used in the with block, short of using set_trace_func or doing my_obj.with %{ ..... }. And this won't work with Rite. -- Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com