T. Onoma said: > I agree that would be nice shorthand for self, if it could be done. Either > that or perhaps: > > my_obj.with { > @.x = 1 > @.y = 2 > @.move_to(10,10) > @.col = :RED > @.repaint > } Well, how about ... module Kernel def with(obj) yield(obj) end end with obj do |s| s.x = 1 s.y = 2 s.move_to(10,10) s.col = :RED s.repaint end "s" is easier to type than "@". Hmmm, some people might find "s" rather non-mnemonic. Perhaps this is better ... with obj do |obj| obj.x = 1 obj.y = 2 # ... end -- -- Jim Weirich jim / weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)