From: Gavin Sinclair Date: 2003-01-24T23:29:36+09:00 Subject: Re: Can we attack the 'not enough libraries' thing straight on? On Saturday, January 25, 2003, 1:10:00 AM, Warren wrote: > it would also be nice to have all the libs assorted like > File/ > Filetools..... > ...... > IO/ > Pipe..... > IPC/ > Msg > SysV...... This would be nice. In the volunteer, every man do his bit, world of Ruby library development, it's not possible to centrally manage this, though. However, Ruby has a nice ability to create aliases to classes/modules, so someone could manage a file that looks like this (I'll demonstrate with IPC, since File and IO are built-in classes): module IPC module Msg require 'ipcmsglib' # Fictitious library installed on system include IpcMsgLib # IpcMsgLib::foo now available as IPC::Msg::foo end module SysV require 'sysvipc' # Fictitious library installed on system include SysVIPC # SysVIPC::quux now available as IPC::SysV::quux end end This could be broken up substantially to save startup time, so the IPC::SysV module is defined in 'ipc/sysv', so only when you require that library does it fetch and include the real SystemV IPC library. To avoid treading on other namespaces, you'd probably put all of this in its own module Std, and directory 'std'. So code looks like this: require 'std/ipc/msg' Std::IPC::Msg::foo ... Or this: require 'std/ipc' # we get everything available in IPC include Std # include this for convenience if safe IPC::Msg::foo ... IPC::SysV::quux ... I think this is a good idea, but unlikely to happen anytime soon. It's nice that Ruby can do it, though. There may be quicker ways to implement it, too, like "IPC::SysV = ::SysVIPC" or something, but I wanted to highlight conditional library mapping. Gavin