From: Martin Weber Date: 2003-01-10T21:06:33+09:00 Subject: Re: 'borrow' Tcl's virtual file system On Fri, Jan 10, 2003 at 05:28:02PM +0900, Yukihiro Matsumoto wrote: > [...] > 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? > > matz. Not really, matz. I haven't used it yet myself, but let me try to explain. The point about VFS is that anything which can open something (like the tcl equivalent of File#open) now is "VFS" aware, i.e. it treats the local files under a VFS (virtual file system) layer. There are implementations to the VFS, offering different access layers to real filesystems, like ext2fs, msdosfs, ffs, etc. Now the whole point is that it's easy to write "plugins" to the VFS, which implement other access methods than to the local filesystem. That said, imagine following ruby pseudo code: require 'vfs' Vfs.mount('type' => 'ftp') File.open('ftp://banzai.net/ayaken.txt') { |f| ... } Vfs.mount('type' => 'http') File.open('http://banzai.net/ayaken.txt') { |f| ... } Vfs.mount('target' => 'foo.tar.gz') Dir.chdir('foo.tar.gz'); Dir.[*] # => lists contents of foo.tar.gz Vfs.mount('target' => 'ftp://banzai.net', 'target' => 'ftp://banzai.net/ayaken.tar.gz') Dir.chdir('ftp://banzai.net/ayaken.tar.gz'); Dir.[*] # => lists contents of ayaken.tar.gz on banzai.net The point is that all 'native' tcl methods use the VFS, and thus you can easily have all the 'native' methods use any extension. See also the (I think a bit outdated) Tcl Wiki page which maybe gives you a better impression of what tclvfs is about: http://mini.net/tcl/2466 Hope that helped -Martin