Project

General

Profile

Actions

Feature #4979

closed

`require 'foo'` is ambiguous when there is both foo.rb and foo.so

Added by terceiro (Antonio Terceiro) almost 13 years ago. Updated almost 13 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:37805]

Description

=begin

When there is both foo.rb and foo.so and a require 'foo' call is evaluated, Ruby 1.8 will load either foo.rb or foo.so depending on which order their directories are in $LOAD_PATH.

Ruby 1.8 will load the first foo.rb or foo.so it finds in the $LOAD_PATH.

Ruby 1.9 will first look for foo.rb in all directories, and only after that it will look for foo.so in all directories. This behaviour seems more consistent than the one in Ruby 1.8. It also matches the most common use case, which is foo.rb loading its sister foo.so that contains native-code implementations needed by foo.rb.

I have attached a test case that shows these different behaviours of Ruby 1.8 and Ruby 1.9.

I propose to make Ruby 1.8 work the same way as Ruby 1.9. If there is consensus about that, I can try to write a patch to backport the behaviour of Ruby 1.9 for Ruby 1.8.

=end


Files

ruby-require.tar.gz (557 Bytes) ruby-require.tar.gz terceiro (Antonio Terceiro), 07/06/2011 03:29 AM
noname (500 Bytes) noname tenderlovemaking (Aaron Patterson), 07/09/2011 02:53 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0