[Rubygems-developers] Gem Names not correlated to require name

Jim Weirich jim.weirich at gmail.com
Tue Sep 30 18:42:07 EDT 2008


On Sep 30, 2008, at 4:51 PM, Jim Freeze wrote:

> One way (just one, mind you) is that if require_gem really required
> the gem. So, you would have
>
>  require_gem 'gem_name_here'
>
> and the gem did the requiring of the files internal.

NO!  That way leads to madness.

That was the function of the autorequire flag on older gemspecs.  That  
lead to early loading of code before the complete gem version  
requirements were given.  This could lead to incompatible version of  
the library being required.

It was also the root cause of causing require "FILE" to return false  
instead of true.  A bug the pragmatically effected absolutely no one  
(who checks the return value of require?), but caused no end of  
questions because people would do a require in irb and see the false  
and think the file wasn't loaded.

The autorequire flag was also the root cause of several other issues  
which escape me at the moment.

BTW, the only difference between the old require_gem and gem methods  
is that gem ignores the autorequire flag.

-- 
-- Jim Weirich
-- jim.weirich at gmail.com



More information about the Rubygems-developers mailing list