On Dec 3, 2008, at 8:55 PM, Dave Thomas wrote:

> On Dec 3, 2008, at 8:40 PM, hemant wrote:
>
>> Why not use const_missing for lazy loading and protect "require" by a
>> mutex (there could be a deadlock, if requires are nested, but in
>> practice I was assuming it can be avoided)
>
> I don't see how there could be a deadlock: once you've claimed the  
> mutex, your thread is the one that will do requires. Any requires  
> nested inside the original one will be executed in the same thread,  
> so simply rescue and ignore the recursive lock exception.

I loved your let's-move-on post so much it actually pains me to write  
this, but can we be totally sure of that?

   Thread.new do
     require "i_so_hope_im_wrong_about_this"
   end

James Edward Gray II