From: Jan Date: 2008-02-06T03:03:08+09:00 Subject: Re: eval vs. class_eval ------=_Part_9797_4329686.1202234595306 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline > > The structure I observe with running the eval version is > > class Fil > class NewClass1 > end > class NewClass2 > end > end I tried both version all get the first result, I think this is a reasonable result(Ruby 1.8.6 on win32). Why do you think the result should be in the 2nd form? > > > but running class_eval I observe > > class Fil > class NewClass1 > class NewClass2 > end > end > end > > I believe the second form should be the result for either eval or > class_eval since they both default to a receiver of self, and when > adding NewClass2 the receiver self should be Fil::NewClass1, not Fil. > > I'm guessing either what I'm observing is wrong somehow or there is a > special rule about eval and the context it evaluates in? > > Carl > -- > Posted via http://www.ruby-forum.com/. > > -- Fly on wheels. ------=_Part_9797_4329686.1202234595306--