From: Erik Veenstra Date: 2006-07-11T05:14:55+09:00 Subject: Re: instance_exec > > I don't understand this though. isn't the memory freed when > > done? Or is some symbol getting created in the process, or > > ? define_method creates a symbol, beneath the surface: symbols1 = Symbol.all_symbols Module.new.instance_eval{define_method("bar"){}} symbols2 = Symbol.all_symbols p symbols2-symbols1 # ===> [:bar] > Yes, that's why InstanceExecHelper must be included in Object > (and you only have to do that once). You should include the Module before Object gets frozen. Who wants to freeze Object, anyway?... ;] > Thread.critical = old AFAIK, we need to be in critical mode when determining the method name. As soon as we know it, we can (and should...) return to old_critical. At least before we call the block/method. > module Kernel > def instance_exec(*args, &block) Kernel#instance_exec ? Does that make sense? About $SAFE: It's possible to do an instance_eval up to level 5, whereas instance_exec fails on level 4. Challenge?... ;] gegroet, Erik V. - http://www.erikveen.dds.nl/