From: Charles Oliver Nutter Date: 2007-07-13T16:33:30+09:00 Subject: Re: Proposal: runtime-modifying Kernel methods should be keywords John Lam wrote: >> 3. These methods are exactly the ones that complicate optimizing Ruby in >> all implementations, including Ruby 1.9, Rubinius, JRuby, Ruby.NET, and >> others. They confound a compiler's efforts to optimize calls by always >> leaving open questions about the behavior of a method. Will it need >> access to a heap-allocated scope? Will it save off a binding or the >> current call frame? No way to know for sure, since they're methods. > > +1 > > We have a design (not implemented yet) to throw on an attempt to alias > Kernel#eval by default. We would enable aliasing eval with a command > line switch along the lines of /MakeItRunSlower :) We have a number of > optimizations for non-local control flow that take advantage of using > static analysis of a block/proc body. These optimizations simply > cannot work in cases where eval appears within the block/proc. If > folks could alias eval then we can't do any of the optimizations at > all, and that is clearly a bad thing. I'm thinking about and have partially implemented an almost identical design for JRuby for this and a few other methods. I think it's also worth stating again that this isn't just for optimization purposes (though that's big)...it's because these features really aren't methods and I feel like they shouldn't masquerade as such. - Charlie