[Rubygems-developers] require_gem/autorequire vs require.

Hugh Sasse hgs at dmu.ac.uk
Wed Jun 1 16:26:46 EDT 2005

On Wed, 1 Jun 2005, Jim Weirich wrote:

> Hugh Sasse said:
>> I seem to have only seem the end of this discussion, not the bit
s/seem the/seen the/ # BYKT :-)
>> where its operation was defined.
> they are really two different things.  So 'require_gem' is really *not* a
> replacement for 'require', and should stand alone.  Also, at some point
> RubyGems gained the ability to 'auto-activate' the latest gem just by
> requiring a file in the gem that can't otherwise be found.
> At that point, 'require_gem' was only needed when you wanted to use a gem
> that was not the latest installed version.  When used in a "select
> version" role, the fact it requires files as a side effect is rather
> annoying.  This is the drive for a new command that does only (1) above.
> Since this new command will not require any files, it should not use the
> word 'require'.  So what should it be called?
> Eric has suggested activate (or activate_gem, or Gem.activate):
> "activate" is the term used internally by RubyGems to denote the process
> of adding a gems directories to the ruby load path.  By activating a

But that's invisible to the user -- i.e transparent...

> specific version of a gem, we make it the one that will be used when
> resolving requires.
> Other terms are possible.  "use" (and its variations use_gem and Gem.use)
> was considered but the Perlness of the work was a bit off-putting.

:-)  Perl's use seems more like our require, so the meaning would be

> "enable" is another possibility.  Since this new command is only needed

We use it to denote which gem we want, so I think gem_select makes
sense.  (-: Of course it would have to have LOTS of tests, because
as Dave and Andy have told us "select isn't broken" :-)

> when specifying versions, something like "lockdown_version" is also
> possible.
> I think I like activate.  It brings to mind turning something on so that
> it is ready to be used.

Turning it on before getting the "required" components sounds like a
recipe for smoke and funny smells, though :-)
> --
         Thank you,

More information about the Rubygems-developers mailing list