From: Joe Wreschnig Date: 2002-07-08T11:18:49+09:00 Subject: Re: What to use for OS-specific module namespaces? --=-V0FLDwYbnEuIkdrnRbK2 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sun, 2002-07-07 at 20:46, nobu.nokada@softhome.net wrote: > At Mon, 8 Jul 2002 10:01:19 +0900, > Joe Wreschnig wrote: > > I'm working on a Ruby module to parse/write to files in the Linux /proc > > filesystem (ACPI interfaces), and I was wondering if there's a preferre= d > > naming convention or namespace for things that are OS-specific. The bas= e > > module is going to be called ACPI, with objects like ACPI::Processor an= d > > ACPI::Battery. Should I prepend something like System:: to ACPI? Or > > should I use something like Linux:: to be more specific? Or am I way > > off, and this stuff could go under the Kernel:: space (it seems to me > > that it doesn't fit with the rest of the code there)? >=20 > Just my opinion. You'll want to install it into system > specific directory (site_ruby/1.7/i386-linux or similar), so I > don't guess Linux:: prefix is necessary. Still, you can make > it prefixed with Linux::, and make alias with System:: or > unprefixed for it. If I name it Proc::ACPI, I need some prefix, or else I conflict with Ruby's internal Proc object (which is unfortunately totally different in purpose). 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. On the other hand, those are really long namespaces; on the other hand, their length might discourage writing non-portable code. ;) Although, the "OS" space is probably removable without much harm. --=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 --=-V0FLDwYbnEuIkdrnRbK2 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) iD8DBQA9KPZ+TFkUq7Drx3cRAojFAKCLv73N4JINc38s4JChZUbjz8Y/YwCfdeh5 4vRhLGAV8JLY46G0QwozHgE= =Ymz/ -----END PGP SIGNATURE----- --=-V0FLDwYbnEuIkdrnRbK2--