From: Dat Nguyen Date: 2000-03-24T09:54:02-05:00 Subject: [ruby-talk:02130] Re: Question the sequence in $: It's the order your PATH is arranged. Rearrange your PATH, you get a new result according to the new arrangement. The 'each' iterator picks up the items in '$:' according to their position in '$:'. Dat >From: Clemens Hintze >Reply-To: ruby-talk@netlab.co.jp >To: ruby-talk@netlab.co.jp (ruby-talk ML) >Subject: [ruby-talk:02129] Question the sequence in $: >Date: Fri, 24 Mar 2000 15:14:44 +0100 (CET) > >Hi, > >I have found the following: > >$ ruby -v >ruby 1.5.3 (2000-03-15) [i586-linux] > >$ ruby -e '$:.each{|p| p p}' >"/usr/local/lib/ruby/site_ruby/1.5/i586-linux" >"/usr/local/lib/ruby/site_ruby/1.5" >"/usr/local/lib/ruby/site_ruby" >"/usr/local/lib/ruby/1.5/i586-linux" >"/usr/local/lib/ruby/1.5" >"." > >As you can see the local directory "." is at the end of the load >path. That means, that my current directory is the last one to be >searched for libs. > >Is this intended? > >I would mean the "." should be the *first* entry within the load >path. My local libs should overwrite site and system ones! If not, I >could not e.g. copy a system lib and patch it. > >I think everywhere the sequence should be: > > local -> site -> system > >Other opinions? > >And while thinking about this, I have another proposal. How about to >include the directory from where the program was started into the load >path too? That would enable me to put my application with its support >libs into an own subdirectory and after starting, the load path would >already contain this directory too! So its support libs could easily >be required too. But this should only happen, of course, if $0 is not >'-' or '-e'. > >Only, I am not sure about the sequence. Should such an application >directory comes before or after "."? Ah ... before I forget, platform >dependend directories within application dir should also be >considered. > >\cle > >-- >Clemens Hintze mailto: c.hintze@gmx.net ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com