On Mon, Aug 05, 2002 at 10:57:27PM +0900, ts wrote: > >>>>> "T" == Tomasz Wegrzanowski <taw / users.sourceforge.net> writes: > > T> How can I find out which constant was missing ? > T> Is it possible to put this code in module so program which uses the > T> module doesn't have to catch anything ? > > I've not yet understood what you want to do. Can you give a concrete > example ? I want to make a module that has functions and classes, just like any other module, but with exception that they created at the time of first usage. So user program calls Foo::Bar.new Foo::Bar isn't registered yet. So Ruby calls some function in Foo, which sees that "Bar" is being requested. It checks in it's database what bar ought to be, creates it, and calls Foo::Bar.new, which returns new object. Next time when Foo::Bar is called it already exists, so nothing extraordinary needs to happen. I think it might be good idea in case when Foo contains lot of classes but only very small percent of them is actually used.