On 2003.01.10, Yukihiro Matsumoto <matz / ruby-lang.org> wrote: > Hi, > > In message "'borrow' Tcl's virtual file system" > on 03/01/09, Phil Tomson <ptkwt / shell1.aracnet.com> writes: > | > |I saw this in an early version of the 'Year in scripting languages' that > |was sent out today and it sounds like a very good idea to me, perhaps we > |should try to 'borrow' it: > | > |"The [Tcl]8.4 release includes a number of significant features, including > | > | * new Virtual File System (VFS) layer that allows (in principle) > | all desired filesystem activity to be diverted away from the > | native operating system and to something else; drivers exist for > | a number of underlying "access methods", including FTP, HTTP, > | Metakit, WebDAV, etc. " > | > |Seems like something that wouldn't be too difficult to do with a series of > |modules. Any ideas? > > I don't anything in detail about Tcl's VFS, but is open-uri in the RAA > > http://www.ruby-lang.org/raa/list.rhtml?name=open-uri > > something close? I don't think so. open-uri (according to the RAA description) is just a wrapper around net/http and net/ftp. Tcl's VFS is a proper virtual file system. The VFS page on the Tcler's Wiki might be a good place to start: http://mini.net/tcl/VFS The basic idea is that when you tell Tcl that you're using a VFS, it secretly redirects all file I/O activity to happen to the VFS and not to the real FS. An example of how this might "look" from Ruby might be: require 'vfs' VFS.open("http://www.ruby-lang.org/") File.open("/index.html") { |f| f.each_line { |line| p line } } VFS.close Looks a lot like open-uri, right? But, can open-uri do this: require 'vfs' VFS.open("/tmp/foo.gz") Dir.mkdir("/blah") # created inside /tmp/foo.gz! File.open("/blah/readme.txt", "w+") { |f| f.puts "this is some text" } VFS.close Now, Dir.mkdir and File.open silently get redirected to operate on /tmp/foo.gz instead of the REAL underlying filesystem. So, you get a whole "virtual" filesystem inside a single file. This makes packaging apps and distributing them simple (one file contains many files, that can be read/written at runtime without having to unpack them). Sounds a lot like what exerb does at some level ... -- Dossy -- Dossy Shiobara mail: dossy / panoptic.com Panoptic Computer Network web: http://www.panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70)