On 19/02/2008, Radosaw Buat <radek.bulat / gmail.com> wrote:
> My favorite is require_relative. Thanks fot that change!
>
>
>  > And again the semantics of mixing require_relative with require are
>  > unclear. As they look up files differently it is no longer easy to
>  > tell if certain file is supposed to be loaded on require or it is
>  > already present.
>
>
> Ruby 1.9 expands all paths keeped in $" so if require_relative would
>  do the same (I think it should) there is no problem.

So if I understand this correctly ruby stores the full path to the
file that is loaded and modifying $: could make the same require
command load a file with the same name from a different place again.

Such as

require 'cgi' # loads cgi.rb somewhere from ruby stdlib

$:.unshift "/my/directory"

require 'cgi' # loads /my/directory/cgi.rb - it is not loaded yet

This would also mean that require_relative would seldom mark the
standard file as loaded.

Thanks

Michal