From: "vo.x (Vit Ondruch) via ruby-core" Date: 2023-11-04T17:01:51+00:00 Subject: [ruby-core:115240] [Ruby master Feature#19985] Support `Pathname` for `require` Issue #19985 has been updated by vo.x (Vit Ondruch). martinemde (Martin Emde) wrote in #note-8: > rubygems has been accepting ducks for years for 99% of Rubyists. During the years, I had already enough fights where Ruby upstream claimed that RubyGems are integral parts of Ruby and using something like `--disable-gems` is a sin. Looking at the issue from this perspective, the only logical conclusion is that Ruby should accept what RubyGems does (what probably really covers more then 99% of use cases) and let `require` accept `Pathname`. Nevertheless, I don't really have a preference, I am looking more for consistency. ---------------------------------------- Feature #19985: Support `Pathname` for `require` https://bugs.ruby-lang.org/issues/19985#change-105156 * Author: vo.x (Vit Ondruch) * Status: Open * Priority: Normal ---------------------------------------- It seems that RubyGems / Bundler `require` method overrides of accept `Pathname` as and argument ~~~ $ ruby -rpathname -e ' pa = Pathname.new("test") require pa ' :85:in `require': cannot load such file -- test (LoadError) from :85:in `require' from -e:3:in `
' ~~~ while plain Ruby require does not: ~~~ $ ruby --disable-gems -rpathname -e ' pa = Pathname.new("test") require pa ' -e:3:in `require': no implicit conversion of Pathname into String (TypeError) from -e:3:in `
' ~~~ This inconsistency is surprising. It seems that RubyGems / Bundler developers think [1] that Ruby `require` should also accept `Pathname`. ~~~ $ ruby -v ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux] ~~~ [1]: https://github.com/rubygems/rubygems/pull/7128 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/