From: Jim Freeze Date: 2002-05-07T09:18:53+09:00 Subject: Re: require and case On Tue, May 07, 2002 at 09:14:35AM +0900, Dave Thomas wrote: > matz@ruby-lang.org (Yukihiro Matsumoto) writes: > > Absolutely - I say > > require 'dbi' > > But under the covers, Ruby expands this to the canonical name, and > stores that canonical name in $". That way, we don't get duplicates > for > > require 'dbi' > require 'dbi.rb' > > etc > > I agree - the feature name stays the same. But when rb_require uses > the relative path to remember what files have been loaded, it's really > a bug, as there are an infinite number of relative paths that all > name the same file. If the contract for 'require' is that it only > loads a given feature once, then not using a canonical name in $" > breaks that contract. > Why is keying off the file name/path the only method used to distinguish file identity. Ruby could hash each file and store the hash. That way, the same file included in two different paths, could be identified as the same. But, hashing a file (unless built-in into ruby) could pose a performance penalty that is not acceptable. Jim -- Jim Freeze If only I had something clever to say for my comment... ~