Logan Capaldo wrote: > You are over simplifying Trans.'s problem. Yea Pit, why are you doing that? ;-) > He wants dynamic generated > methods scoped to a module, or optionally scoped to the top level. > You can't use #define_method at the top level because instances don't > respond to it. You can't use the toplevel singleton class as I > suggested because a) it's a pain in the neck and b) it doesn't > inherit the right way. > > Trans, what about: > > # Warning evilness ensuing: > > def main.define_method(*args, &block) > Kernel.module_eval{ define_method(*args, &block) } > end That's basically what I ended up doing: def define_method( meth, &block ) Object.class_eval do define_method( meth, &block ) private meth end end def ancestors Object.ancestors end But as I was saying about the instance variables, it not quite that simple. I still had to build exceptions into the module code. I just tried to factor these down to the fewest points of departure as possible. So I end up with a few areas like this: $main = self def instance_task_table if self == $main Object.instance_task_table else @instance_task_table ||= {} end end and cont = (self == $main ? Object : self ) Certainly not simple. But so far it appears to be working. I just hope I've got all the namespace dicing covered. Thanks, T.