require system

T

Trans

Was thinking about the way libraries are required, and the potential
for load conflicts. Of course, if anyone has ever run into it this I'm
sure they worked around it ASAP, but I think it's good take a look at
these potential scenarios.

What if someone created a project with their own version of smtp.rb,
and in their project the path they used was lib/net/smtp.rb. After
installing via setup.rb, we find that some of our other programs are
no longer working. Why? Because they use:

require 'net/stmp'

but are no longer loading the built-in ruby library b/c site_ruby
occurs first in the load path, and this new "net/stmp.rb" appears
there.

OTOH, if we installed via RubyGems, and do the same, our other
programs still work, but our new lib isn't accessible b/c Gems first
attempts to load via Ruby's normal #require method. However, if one
activates the gem, eg. gem 'foonet' (or whatever the gem may be
called), then we may again run into issues if another lib also being
used depends on the core lib.

This could occur for any core or standard lib, or between 3rd party
libs for that matter.

T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top