* ts (decoux / moulon.inra.fr) wrote:

> >>>>> "T" == Thomas Hurst <tom.hurst / clara.net> writes:
>
> T> Have require insert the basename of the file that's loaded into $",
> T> rather than just the relative name?
>
> You can't. You can have 2 differents modules with the same name but a
> different path (this is stupid but this can exist).

Of course, I meant the fully qualified name:

require 'foo'
 => resolve the extension
 => dereference any links
 => expand_path 'foo.rb' => /usr/home/freaky/bla/foo.rb
 => check $" for /usr/home/freaky/bla/foo.rb
 => if not there, load it and insert it

require './foo'
 => resolve the extension
 => dereference any links
 => expand_path './foo.rb' => /usr/home/freaky/bla/foo.rb
 => check $" for /usr/home/freaky/bla/foo.rb
 => already there, skip it

The current behavior would reload ./foo.rb, which is not really
expected. load is there to reload a file if that's desired; require is
not.

>  More generally you really want that ruby don't distinguish
>
>   'MICROS~1.RB' and 'Microsoft.rb'
>
>  just because a stupid OS can't distinguish the 2 :-)))

I might be tempted to suggest expand_path resolve the short version to
the long one.  But can you suggest why you might want to use the short
version in the first place?

-- 
Thomas 'Freaky' Hurst  -  freaky / aagh.net  -  http://www.aagh.net/
-
A lot of what appears to be progress is just so much
technological roccoco.