-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed Autoload to use Module#Autoload in AS::Dependencies #6
base: master
Are you sure you want to change the base?
Conversation
Current issues: - Need to create dummy file for nested constants with a base class defined
We will merge the commits into one after the changes are discussed. |
This means that temporary files inside |
Ah, got it. It will be inside the railsloader tempfile storage. |
Sorry about the response time. I don't think I'll have a lot of time until finals week is over (5/11). |
@tsun1215 what exactly do we want to accomplish with I've added |
Once we have a list of changed constants, we add them to the correct lists of constants so that they are removed when the rest of the autoloaded constants are removed. |
@tsun1215 cool so what I've got is a start to that. okay to merge it in to your stuff? |
Go for it, you have access |
(This is in response to: https://gist.github.com/matthewd/9e54b38bc5184134388b)
Summary
The autoload functionality of
ActiveSupport::Dependencies
has been changed from usingObject.const_missing
toObject.autoload
for pre-installing autoloads for all constants to be loaded.This behavior is achieved for all types of constants, including nested multi-file ones, by creating temporary files (using the Tempfile gem) that serve as intermediate files for setting up and loading constants. Currently, single file constants are loaded using a temporary file so that we can decide to hook in to the autoloading of a constant if necessary--which may be the case when trying to add the new constant watcher.
Example
In the test fixture, we have the folder structure: https://github.com/rails/rails/tree/master/activesupport/test/autoloading_fixtures/a
Our autoload will create the following structure in a temporary file:
Then :A is autoloaded into
Object
, pointing to this file.Compatibility
Currently, 17 of the
activesupport/test/dependencies_test.rb
are marked as skipped. Many have the commentNOT SUPPORTED
indicating that it is a test that tests deprecated behavior (for example, using load_missing_constant); these have been left there for review and examples. Other tests were either not gotten to or specify a functionality that is not yet implemented.In the rest of the ActiveSupport suite, the changes break 1 test in MessageVerifier (it seems like it tests an old behavior) and 2 tests in DescendantsTracker.
Unfinished