From: Brian Candler Date: 2003-05-09T00:37:06+09:00 Subject: Re: [Q] Block passing: obj.new(){block} On Fri, May 09, 2003 at 12:32:08AM +0900, Peter Schrammel wrote: > I know but I'd like to envoke a lot of methods in the object on creation > and thought of something like: > > t=Test.new(){var1=89,var3=89,var54="bar",onEvent("Click"){puts "You > clicked"},doSomething(1,2)} > > if I had to type self.xxx everytime or do t.varxxx=xxx I'd go nuts. Unfortunately you do, or else '@var1=89'. What you have written creates temporary local variables called 'var1', 'var3' etc, and then discards them at the end of the block. Regards, Brian.