2011/1/24 Eric Hodel <drbrain / segment7.net>: > Sorry my response came so late, I got distracted. Yup, no problem. I prefer that it takes long and that it's solved once and for all. >> == Backward-compatible hack >> >> The simplest way to fix this without breaking backward compatibility, >> is to introduce a second method with signature (naming is bad): >> >> Kernel.require_search(feature) -> path | nil >> >> On #require, if no path is found, it will fallback on this method, if >> it exists. > > This does not behave in a way that RubyGems can use it. > > RubyGems needs to be able to insert a load path before the system load paths so that rubygems-provided features may override built-in features. > > By your description, with this patch if I gem 'rdoc' then require a file I will always get the built-in rdoc (or worse, a mix of the two if there are new files added to the gem). Hmm, okay, yeah my patch still relies on rubygems unshifting into $LOAD_PATH. It works, but it only avoids overriding #require (and shifts the problem with #require_search as you mentioned). This is because I assumed that usually only one package-manager would live in the same ruby instance and that an unique method call is faster than other approaches. >> This means that rubygems and any other package-managers can >> fight over this method, and leave #require alone. If they want to >> change $LOAD_PATH for future requires, then it's fine too. > > I am looking for a solution that removes the need to override a method instead of one that simply changes which method to override. Ok, let me come up with another approach, I think I got something nice, but still need some reflection on it. Cheers, zimbatm