Alex Gutteridge wrote:
> Is there any difference between the two versions, or is it just a style 
> preference?

Maybe to avoid exposing the constant, H?

But unfortunately it breaks gems... Maybe because it references 
Kernel#require before gem does its thing with it? Not sure why the same 
doesn't happen with alias, though.

Anyway, combining your approach with Ara's seems to take the best of each:


p Kernel.requiree('main')

require 'b'

p Kernel.requiree('main')

require 'fox16' # or your favorite gem

BEGIN {
   module Kernel
     h = Hash.new
     define_method(:requiree) do |of|
       h[of]
     end

     alias :old_require :require
     define_method(:require) do |*a|
       old_require(*a)
       h[a.first] = caller
     end
   end
}


-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407