Require system

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs