GithubHelp home page GithubHelp logo

Comments (3)

fxn avatar fxn commented on August 28, 2024

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.

fxn avatar fxn commented on August 28, 2024

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.

pitr-ch avatar pitr-ch commented on August 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.