On Sunday 17 April 2005 11:58 am, Ryan Leavengood wrote:
> Chad Fowler wrote:
> > You miss the point:  if RubyGems were included in Ruby's default
> > distribution, it would be integrated, and you'd never have to use
> > require_gem again (though, you could still use require_gem to load a
> > specific version of a library).
>
> I kind of wondered why you added require_gem instead of just overriding
> require like I originally did, but I see that until RubyGems is in the
> default distribution, it is the friendly thing to do.
>
> Also once you get to that point you still wouldn't need require_gem,
> even for the version specification:

Actually, there is an important difference between require_gem and require.  A 
require statement is a request to load a particular file into the ruby image.  
A require_gem statement activates (enables, selects) a versioned package.  
The key point is that a package name is not the same as a file name.  
Although there is some overlap, there are many cases where this is not true.

I think Rails is doing the smart thing w.r.t. package management.  All the 
require_gems are located in the environment section of the application.  When 
a rails app wants to explicitly switch to a different library version, there 
is only one place to go to make that change.  If we allowed version specs on 
each and every require statement throughout the application, changing 
versions would be painfull indeed.

I think the separation of versioning statements from require statements is a 
good thing to maintain ... even in an integrated system.

BTW, if you don't want to use require_gem statements, you don't have to.  
RubyGems will, by default, use the latest loaded version of a gem library. 
What you *do* need to do is make sure RubyGems is loaded in order to take 
advantage of any installed gems.  That's the pain that would go away with an 
integrated rubygems library.

-- 
-- Jim Weirich    jim / weirichhouse.org     http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct, 
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)