Include Module::Constants - opinion question

How do I do that for a core class, though? If I want to shorten the IO
constants, I can’t seem to do “include IO”, because IO is a class and not a
module. I’m sure I’m missing something obvious here, but I don’t see it at
the moment. :frowning:

Regards,

Dan

···

-----Original Message-----
From: Lyle Johnson [mailto:lyle@users.sourceforge.net]
Sent: Monday, July 29, 2002 1:15 PM
To: ruby-talk@ruby-lang.org
Subject: Re: include Module::Constants - opinion question

Berger, Daniel wrote:

I recently installed the syslog module and I noticed that
it does something
rather nice - it allows you to do “include
Syslog::Constants” so that I can
avoid having to type “Syslog::” in front of all the
constant names. Helps
with the carpal tunnel, and looks prettier.

I noticed that, by and large, most Ruby modules do not do this.

I have two questions. First, should module authors add
this functionality
or are people worried too much about the possibility of
namespace collision?
Second, if that isn’t a fear, should such functionality be
added to the Ruby
core modules?

How is this functionality different from just doing:

 include Syslog

Is it that you’re wanting to only include the constants but not the
other stuff?