-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Tanaka Akira wrote:
>> To decide what directories should be added to $LOAD_PATH, we need to
>> check Gem::Specifications in specification directory.  ruby-debug gem
>> defines 'cli' directory as a requrie_path for example.  Here's an
>> implementation what should be done by 'gem load only' gem handler.
>> http://dev.ctor.org/vtr
>> It supports version control but it should be removable easily.
> 
> Oh, I didn't know that.  Thank you for the information.
> However I don't like loading all gemspecs.
> 
> Since the condition can be conservertive, the glob can be changed to 
>   Dir.glob(".../lib/ruby/gems/1.9/gems/**/#{feature}*")
> for supporting such libraries.
> 
> Do you know a library which cannot be supported by the glob
> above?

No.  It should be enough for that purpose.  Usually gemspec writers do
the same thing.

  Gem::Specification.new do |s|
    ...
    s.files = Dir.glob("{bin,lib,test}/**/*")
    s.require_path = "lib"
    ...
  end

But then 'require "doc/index.html"' causes to load rubygems you know.  I
know that this fallback checking can be conservative but I don't like
this kind of uncertain behavior.  What's wrong when we just do the
following?

  begin
    original_require feature
  rescue LoadError
    require 'rubygems'
    original_require feature
  end

Worried about memory footprint?  When I use gemloader.rb (at
http://dev.ctor.org/vtr), process VSZ/RSS is as follows.  ruby 1.8.6
(2007-10-15 patchlevel 5000) [i686-linux] on CentOS 5 + Linux kernel
2.6.18-8.1.14.el5.  (sorry for it's not ruby 1.9.  gems I have is not
run under 1.9)

   VSZ /RSS
- ----------------------------------------------------------------------
A) 3136/1504 ... just started a ruby process
B) 3284/1804 ... loaded 'gemloader.rb'
C) 4036/2676 ... loads all gemspecs I have. 28 gemspecs, total 160KB.
D) 4300/2868 ... activates 'initializer' in Rails/1.2.5.

# bear in mind that D is not the whole size of Rails app.  ActiveSupport
# delays loading of tons of necessary features.

Here's a script;

  p 'A) base'; STDIN.gets

  require 'gemloader'
  p 'B) loaded'; STDIN.gets

  Gem::LoadPathWeaver.repository
  p 'C) gemspecs cached'; STDIN.gets

  require 'initializer'
  p 'D) activated'; STDIN.gets

- From memory footprint point of view, I think rubygems can be slimmed as
well as gemloader.rb by targeting 'extract features just for gem
loading'.  I won't say they should do that because it may introduce
duplicates and complexity in the code.  Anyway it's up to RubyGems team.

akr, do you think above footprint is acceptable?

>> Matz, akr, and ko1, you wamt to just include Kernel.require of rubygems
>> and no Kernel.gem and version control, right?  What is different from
>> just installing files to site_ruby dir then by rpm or deb?  What is the
>> point you want to include from rubygems?
> 
> Someone might install a library as gem.  I don't want to
> care the library is installed as gem or not.  This is my
> reason.  Is it not enough?

Thanks for the explanation.  I agree with your claim.  Before writing my
opinion; You really don't want to include Kernel.gem and version control
by default, right?  According to the previous proposal of yours (require
'rubygems' fallback), Kernel.gem is not enabled by default but rubygems
loads dependency libraries according to version requirement specifications.

When we install an application/library package via gem, it has a version
dependency even if users won't see it explicitly.  So including rubygems
without Kernel.gem and version control is not enough for your claim I think.

Correct me if I misunderstand your point.  Your proposal on
[ruby-dev:31944] was 'when we include rubygems, it should be enabled by
default'.  Your proposal may include Kernel.gem fallback, too?

Regards,
// NaHi

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)

iQEVAwUBRxoXHh9L2jg5EEGlAQKxjAf/T2Leekbq7x8eiUSzkDMnBodv9uaxwwn/
86D9eG3nFDIxJwoTZf+ELUIAGo076jPf0a87vsr/CifWHhfVHbpT86HgxYkXiFEz
67wj3ZGu+dvVfezxZbmhKP4nLyH3GiGp6C4fsvff+t9NGF8EDFzC7D4I2gXg6h6G
V6GdxV1LnhQAv3JBRS1J0JEWvfzzo1+KfI8HTP8R2rq5f+vuKvjGd4Ig8mpWlWau
w8P7TNPchW+3bCE6Altd23rzWWPIyVqg196Vi/TVo5gFArxpyPU/UfVMlVqsbD+Y
8B7VeknNhfanNroUASHNjs7n3xQs8me+KWu6wY2rhu50B3hF4LcCpA==
=FIxQ
-----END PGP SIGNATURE-----