Gennady
2/19/2005 6:20:00 AM
On Feb 18, 2005, at 4:59 AM, Zev Blut wrote:
> On Fri, 18 Feb 2005 21:09:47 +0900, Nospam
> <news.home.nl-1@nospam.no-nonsense.org> wrote:
>
>> It seems that although require normally makes sure a certain files
>> only gets included once require somehow doesn't take into account the
>> file the interpreter first included.
>
> Exactly, but should this be the case?
require provides a simple mechanism trying to prevent multiple file
loads -- it keeps loaded file paths in array $" just as given
(appending a proper extension - .rb, .so, etc. - if it is missing) and
does not load a file if the same path is already present in the array.
It is very easy to trick it by requiring the same file using different
paths, like in "test.rb", "./test.rb", "././test.rb".
In general, it is very hard and time consuming to determine that
different paths refer to the same file, so require does not even try to
pretend that it is robust.
Knowing how require works, you can easily implement some work around
for your particular case.
>
> Cheers,
> Zev
>
>
>
Sincerely,
Gennady Bystritsky