Comments (3)
There are several thread-safety concerns addressed in the library. Some are solved with mutexes, others by using CRuby's Hash
or Array
. When Zeitwerk supports JRuby or TruffleRuby it will probably use Concurrent::*
classes instead.
Regarding autoloading, that safety is inherited from the thread-safety of autoload
and require
themselves. Those are thread-safe in Ruby. The test suite has coverage precisely for the use case you're mentioning.
The version of Ruby depends on a few things. We need that Kernel#autoload
calls Kernel#require
, for example. In the past it called a private internal C function that was not reachable to be decorated, and that is still the case in JRuby.
Also, the library assumes that $LOADED_FEATURES
stores real paths. In particular, that it resolves symlinks in UNIX. This was a change introduced in 2.4.4. Could be relaxed by programming for boths cases, real and not real, but for this version I want to get Zeitwerk right first, then perhaps add that kind of complexity. Not sure I'll want the code base to have that kind of logic right now, however, Ruby moves forward and releases are left behind. Time will tell.
from zeitwerk.
BTW, since you're are working on TruffleRuby, it might be of your interest to know the test suite has a file with some Ruby compatibility properties. I need to add code comments to document how does the library depend on each one of them. Not sure if the suite is exhastive as of today, should do a pass.
from zeitwerk.
Right, I've forgot autoload will block other threads accessing the constant until it's fully loaded. Thanks for the answer.
The 'Ruby compatibility properties' test is very useful thanks. I'll have look later how compatible we are.
from zeitwerk.
Related Issues (20)
- Zeitwerk not loading children of struct namespaces HOT 5
- Zeitwerk not autoload the middleware directory HOT 2
- Zeitwerk, omniauth and multiple DBs (connects_to) HOT 9
- (Re-)Loading modules defined as a root namespace HOT 2
- Ruby 3.3.0-rc1 warning issues HOT 3
- Gemfile/gemspec csv HOT 2
- Getting the source location of a constant while loading it HOT 12
- Gem's loader is being setup multiple times HOT 24
- Autoloading not working in rake task HOT 4
- Zeitwerk::NameError on calling Zeitwerk::Loader.eager_load_all HOT 11
- Deprecation message coming from zeitwerk HOT 2
- Reloading of local gems HOT 27
- drb was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0 HOT 3
- Ruby 3.4.0 no longer includes "abbrev" and it suggests zeitwerk to include it HOT 2
- Error when using in Ractor HOT 3
- Namespaced concerns don't load HOT 33
- Zeitwerk::NameError for gem VERSION HOT 8
- Add CHANGELOG.md to gem HOT 3
- `eager_load` clobers previous `eager_load_dir` and `load_file` calls? HOT 6
- In Rails, `app/jobs/seeder/` directory breaks `db:seed` task HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zeitwerk.