Requiring multiple libraries

Is there a stylistic and/or technical reason that the ability to require
multiple libraries on one line, such as:

require ‘mysql’, ‘yaml’, ‘ftools’

has never been implemented-- or is it planning to be?

···


Bruce Williams http://www.codedbliss.com
iusris/#ruby-lang bruce@codedbliss.com

alias :old_require :require
def require(*args)
args.each { |libname| old_require libname }
end

require ‘mysql’, ‘yaml’, ‘ftools’

– Dossy

···

On 2002.09.16, Bruce Williams bruce@codedbliss.com wrote:

Is there a stylistic and/or technical reason that the ability to require
multiple libraries on one line, such as:

require ‘mysql’, ‘yaml’, ‘ftools’

has never been implemented-- or is it planning to be?


Dossy Shiobara mail: dossy@panoptic.com
Panoptic Computer Network web: http://www.panoptic.com/
“He realized the fastest way to change is to laugh at your own
folly – then you can let go and quickly move on.” (p. 70)

Bruce Williams wrote:

Is there a stylistic and/or technical reason that the ability to require
multiple libraries on one line, such as:

require ‘mysql’, ‘yaml’, ‘ftools’

has never been implemented-- or is it planning to be?

Perhaps it is this way for symmetry with load?
http://www.rubycentral.com/book/ref_m_kernel.html#Kernel.load
I found myself moving alot of declarations back and forth between
require and load while working on a project using IOWA, changing things
at runtime by replacing a require on a template page with load and going
to the page in the browser.

···


([ Kent Dahl ]/)_ ~ [ http://www.stud.ntnu.no/~kentda/ ]/~
))_student
/(( _d L b_/ NTNU - graduate engineering - 5. year )
( __õ|õ// ) )Industrial economics and technological management(
_
/ö____/ (_engineering.discipline=Computer::Technology)

The implementation itself is, of course, not difficult. :slight_smile:

For the most part I was just wondering why it hasn’t been.

···

On Sunday 15 September 2002 05:41 pm, Dossy wrote:

alias :old_require :require
def require(*args)
args.each { |libname| old_require libname }
end

require ‘mysql’, ‘yaml’, ‘ftools’

– Dossy


Bruce Williams http://www.codedbliss.com
iusris/#ruby-lang bruce@codedbliss.com

One reason might be that with multiple files
it’s impossible to tell which one failed.
require returns false if it fails.

Hal

···

----- Original Message -----
From: “Bruce Williams” bruce@codedbliss.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Monday, September 16, 2002 5:51 AM
Subject: Re: Requiring multiple libraries

On Sunday 15 September 2002 05:41 pm, Dossy wrote:

alias :old_require :require
def require(*args)
args.each { |libname| old_require libname }
end

require ‘mysql’, ‘yaml’, ‘ftools’

– Dossy

The implementation itself is, of course, not difficult. :slight_smile:

For the most part I was just wondering why it hasn’t been.

Ok, that’s definitely an explanation; I personally [very, very] rarely test a
’require’, so the thought hadn’t occured to me.

It just seems odd to me that, in a VHLPL language that generally seems so
’eloquent’ (or at least terse), you have to stutter out ‘require’ several
times on a regular basis. POLS would dictate (IMHO) a more direct approach
to something done so regularly.

···

On Monday 16 September 2002 07:00 am, Hal E. Fulton wrote:

One reason might be that with multiple files
it’s impossible to tell which one failed.
require returns false if it fails.

Hal


Bruce Williams http://www.codedbliss.com
iusris/#ruby-lang bruce@codedbliss.com