Issue #15903 has been updated by Eregon (Benoit Daloze).


Thanks for discussing the issue at the meeting.

I think having singleton-only methods on `Kernel` would be OK, and probably most of us agree having the instance method is not warranted for a rarely-used method.
`Kernel` makes sense to me, because it's where `require` and `load` are defined, and `resolve_feature_path` is a subset of those methods.

My main concern with `$LOAD_PATH` is documentation (e.g., where would it be listed on https://docs.ruby-lang.org/, there is no class, `globals.rdoc` doesn't seem right) and discoverability (hard to find it when searching for it), but otherwise it sounds fine.
Another concern with defining it on `$LOAD_PATH` is `resolve_feature_path` does not depend only on `$LOAD_PATH` but also on other values such as `Dir.pwd`, and maybe other things if the feature lookup changes behavior in the future.

Dear @matz, could you decide between `Kernel` and `$LOAD_PATH`?
I would be happy with either, and I believe that would be much better than `RubyVM` (as explained in the description).

----------------------------------------
Feature #15903: Move RubyVM.resolve_feature_path to Kernel.resolve_feature_path
https://bugs.ruby-lang.org/issues/15903#change-78576

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 2.7
----------------------------------------
RubyVM contains mostly MRI-specific features but `resolve_feature_path` is clearly not MRI-specific.

So I propose to move it as a class method of `Kernel`.
I think this makes sense given the related `load` and `require` are defined in `Kernel` too.

Moreover, moving this method outside `RubyVM` is *necessary* for other Ruby implementations to implement it, and keep the clean separation that `RubyVM` is only defined on MRI (see #15752).

So, can I move `RubyVM.resolve_feature_path` to `Kernel.resolve_feature_path`?

Do we need to keep the method on RubyVM (and deprecate it), or can we just remove it since anyway API under RubyVM is not stable?

cc @mame



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>