From: Kent Dahl Date: 2002-08-22T03:13:10+09:00 Subject: Re: instance_eval Christian Szegedy wrote: > I would like to achieve that the code block of f > is evaluated in the context of the new MyClass object. > It is evaluated in the main context. > > Is there a way to rewrite my f function so that > the last line of the code prints 1 instead of nil, > or is it pricipially impossible in Ruby? What version are you using? I get "1" on both ruby 1.6.6 (2001-12-26) [i586-linux-gnu] and ruby 1.7.2 (2002-07-13) [i686-linux] -- (\[ Kent Dahl ]/)_ _~_ __[ http://www.stud.ntnu.no/~kentda/ ]___/~ ))\_student_/(( \__d L b__/ NTNU - graduate engineering - 5. year ) ( \__\_�|�_/__/ ) _)Industrial economics and technological management( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)