From: Joe Wreschnig Date: 2002-07-08T12:50:28+09:00 Subject: Re: What to use for OS-specific module namespaces? --=-pCYUFyY9ts47BkhnnNH+ Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sun, 2002-07-07 at 21:59, nobu.nokada@softhome.net wrote: > > Maybe there should be some standard (e.g. Perl has sys and sys/linux > > which is mostly a C holdover I think). Maybe OS::Linux, OS::Windows, > > etc? It would allow OS::Linux::Debian, OS::Linux::RedHat, and things > > like OS::Linux::Proc for things that are cross-distribution, similar > > things could be done with with Windows and OS::Windows::NT, > > OS::Windows::9x, OS::Windows::XP (which would in theory mix in NT and > > 9x), and OS::Windows::Win32 for the common APIs. >=20 > I agree about the first sentence, but cannot imagin the > needs/advantages for per-distribution namespaces. The only function that came to mind at the time for distributions was distribution version, but in retrospect, that's the only one I can think of, and also my hierarchy might even be backwards (e.g. there's three BSD, Linux, and Hurd kernels for Debian, and WINE would be something like UNIX::Win32, which doesn't fit in at all). So yeah, the distribution-specific namespace is a bad idea. > If I were you, I'd implement in long namespaces and provide > short aliases. For example, in i386-linux/os.rb >=20 > module OS > module Linux > def self.processor > # ... > end > module ACPI > # ... > end > end >=20 > # shorthands > def self.processor > Linux.processor > end > ACPI =3D Linux::ACPI > end That sounds like a good idea; it might later contain tests to pick the right aliases depending on the underlying system. > ...but I worry wheather processor is an attribute of OS. May > SysInfo or something be better? Another good idea; thanks. :) I thought about calling it "Hardware" originally, but since I'm not using actual hardware calls but the data published by the kernel, I switched to OS. SysInfo is a good compromise between the two. --=20 - Joe Wreschnig - http://www.sacredchao.net "What I did was justified because I had a policy of my own... It's okay to be different, to not conform to society." -- Chen Kenichi, Iron Chef Chinese --=-pCYUFyY9ts47BkhnnNH+ Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQA9KQv9TFkUq7Drx3cRAl53AKCpNZ3dMijYJYhTCQs6qpZnS6xP9ACeKXMX lIaTA/lSRqRKH0zRacu8G20= =rjVp -----END PGP SIGNATURE----- --=-pCYUFyY9ts47BkhnnNH+--