From: tyler@... Date: 2019-04-18T23:41:55+00:00 Subject: [ruby-core:92325] [Ruby trunk Feature#8834] Kernel#load_relative Issue #8834 has been updated by TylerRick (Tyler Rick). This seems like a curious omission. It would be useful to have a `load_relative` that loads relative to the script path calling it, like `require_relative`. I guess the workaround is to use `__dir__`? ``` ruby load File.join(__dir__, 'other.rb') ``` ---------------------------------------- Feature #8834: Kernel#load_relative https://bugs.ruby-lang.org/issues/8834#change-77667 * Author: sawa (Tsuyoshi Sawada) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- The intended difference between `Kernel#require` and `Kernel#load` is that the former is for external libraries and the latter is for Ruby scripts internal to the project. Considering this fact, `load` should be more likely than `require` to be used in a situation where you want to call a file through a relative path. Strangely, there is `Kernel#require_relative`, but no `Kernel#load_relative`. I request `Kernel#load_relative`. It is even more necessary than `Kernel#require_relative`. It seems to me that people are using `Kernel#require_relative` when they want to use a relative path, even in the context where they are supposed to use `load` because of the lack of `Kernel#load_relative`. I don't think this is a good practice. Furthermore, in cases where you have a file without a `.rb` or other extention that you want to call via a relative path, there is no good way to do it. -- https://bugs.ruby-lang.org/ Unsubscribe: