In article <471A1720.4080606 / sarion.co.jp>, "NAKAMURA, Hiroshi" <nakahiro / sarion.co.jp> writes: > But then 'require "doc/index.html"' causes to load rubygems you know. I If nobu's proposal [ruby-core:12770] is accepted, the loader can check loadable extensions. So doc/index.html can be ignored because .html is not a loadable extension. Hmm, this is 5th benefit of the proposal. > 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 I think there are too many cases loading RubyGems unnecessary if no additional check. For example, lib/tmpdir.rb checks Win32API using LoadError. > 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) I'm not sure the threshold between acceptable and unacceptable memory consumption. However lower memory consumption is better if the solution is good enough. I feel my tiny loader is good enough. Another concern is about maintainance. Do you maintain gemloader.rb? > 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. I don't want to care the library is installed as gem or not. I assume a library may be installed as not gem. gem method doesn't have effect for such library. So, there are no reason to use gem method (in the situation I don't care gem or not). > 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. Since gem method depends on RubyGems, using gem method makes a source code RubyGems dependent. It is what I don't want. However version control is accomplished in some way. For example, an administrator chooses appropriate version when a library is installed under site_ruby. gemspec may be another way. > 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? [ruby-dev:31944] is just a question. My proposal is 'when we include rubygems, require method can load a library installed as gem'. gem method is not important for me. I like it is not defined until an application require 'rubygems' explicitly, though. -- Tanaka Akira