From: "Benjamin J. Tilly" Date: 2001-04-22T01:01:07+09:00 Subject: [ruby-talk:13984] RCR, strange things in $: I decided to catch up on old summaries of p5p, and I ran across a description of how (in Perl) you will be able to play games like reading a module from a zip file: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-02/msg01780.html Well that is a little convoluted, but since Ruby's $: is a relative of Perl's @INC, I have to wonder whether something like this is possible for Ruby. But of course simpler, better designed. So here is the request. $: should allow objects to be placed in it. Whenever Ruby goes to search for a module it should check for whether a method named something like, "find_file" is implemented. If it isn't, then act as it does now. If it is, then call the method with the name of the file you are searching $: for. It should return either nil (not found) or an object matching a specified subset of the API for objects of class IO. Example uses: 1. Allow modules to be loaded from a zip archive. 2. Allow modules that are transparently installed upon first use from a remote repository. 3. Allow modules to be run through a preprocessor before loading. In fact (more thought would have to go into this) why not add a method to File::Open which takes 2 arguments, and returns a filehandle for read, and then have Ruby call that when it loads from $:? That would allow the same API that I am suggesting for modules to also be used inside of Ruby as well... Cheers, Ben