Include Module::Constants - opinion question

Hi all,

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?

e.g. include IO::Constants -> Can now type SEEK_CUR instead of IO::SEEK_CUR.

Opinions wanted. :slight_smile:

Regards,

Dan

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?