From: Charles Comstock Date: 2004-04-22T06:49:07+09:00 Subject: Re: binding - how to get current script? Yukihiro Matsumoto wrote: > Hi, > > In message "Re: binding - how to get current script?" > on 04/04/21, Kirk Haines writes: > > |If one replaces name with @name, then it works. There is probably a > |logical explanation for why local variables behave in this way within an > |eval, but I do find it surprising, coming from Perl. > > Local variable determination is done in compile time, so that eval > (which is done in run time) cannot affect the determination. It's > just too late. But "irb" does compile and execute line by line. > That's the reason eval works for irb (i.e. eval is executed before > compiling the next line). > > matz. > > Why is there this difference between compile time and runtime? I had assumed compile time was just a big eval call? Also, what happens when you eval inside an eval is that a seperate scope or the same? Charles Comstock