Hugh Sasse said:
> On Wed, 1 Jun 2005, Gavin Sinclair wrote:
>>> On Wednesday, June 1, 2005, 11:00:40 PM, Jim wrote:
>>>>> I think I like the simple activate, or even activate_gem better.
>>>>> activate_gem 'RubyInline', '= 3.2.2'
>>> require 'inline'
>>>> The only difference is the name:
>>>> Gem.activate 'RubyInline', '= 3.2.2'
>> require 'inline'
>>>> Not sure what your point is about "starting a new app". But like I
>> said, the only difference is the name.
>>>> Gavin
>> What puzzles me is the name. What is the activate doing? To me,
> you can only activate something if you have it but here it is being
> activated before require'd. So why is it activate rather than
> obtain, require, acquire, or some such name?
>> I seem to have only seem the end of this discussion, not the bit
> where its operation was defined.
This started off as a discussion of require_gem and how it is really doing
two things (1) moving a gem's directories into the load path and (2)
requiring any files marked as autorequire in the gem.
The reason it does two jobs is historical, and comes from the early
feeling that 'require_gem' was a replacement for 'require'. As our
understanding of the role of 'require_gem' evolved, we realized that
'require_gem' operates on gems, and that 'require' operates on files, so
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
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.
"enable" is another possibility. Since this new command is only needed
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.
--
-- Jim Weirich jim at weirichhouse.orghttp://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)