[#109095] [Ruby master Misc#18888] Migrate ruby-lang.org mail services to Google Domains and Google Workspace — "shugo (Shugo Maeda)" <noreply@...>
Issue #18888 has been reported by shugo (Shugo Maeda).
16 messages
2022/06/30
[ruby-core:109004] [Ruby master Feature#18841] Proposal: autoload_relative
From:
"ioquatix (Samuel Williams)" <noreply@...>
Date:
2022-06-19 08:04:33 UTC
List:
ruby-core #109004
Issue #18841 has been updated by ioquatix (Samuel Williams). Yes, great idea, and I can confirm I've run into issues with autoload loading the wrong files if you combine `autoload` with `require_relative`. Also, since this does not exist yet, we can be more strict on how this works, as in `autoload_relative` can raise an exception if the constant is not defined correctly. ---------------------------------------- Feature #18841: Proposal: autoload_relative https://bugs.ruby-lang.org/issues/18841#change-98114 * Author: fxn (Xavier Noria) * Status: Open * Priority: Normal ---------------------------------------- In my experience, autoloads often reflect an existing hierarchical structure. If a project does not use Zeitwerk, and the user declares autoloads for a class or module, chances are they are for child constants. As an example, see the [`ActiveRecord` module](https://github.com/rails/rails/blob/main/activerecord/lib/active_record.rb). (Those ones do not have a second argument because we define wrapper that derives it by convention, [here](https://github.com/rails/rails/blob/main/activesupport/lib/active_support/dependencies/autoload.rb)). I think it would be convenient to have an `autoload_relative` in the line of `Kernel#require_relative`. It would make existing patterns more concise, and as a practical consequence, you skip `$LOAD_PATH` lookups too. -- 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>