(日本語は後の .jp.md を参照してください)
This document is frequently asked questions and answers about "Namespace on read" for Ruby by tagomoris. "Namespace on read" is proposed to Ruby by tagomoris (but not yet accepted), and a talk in RubyKaigi 2024 introduced it.
- The proposal: https://bugs.ruby-lang.org/issues/19744
- The current patch: tagomoris/ruby#4
- The talk details: https://rubykaigi.org/2024/presentations/tagomoris.html#day1
- The presentation slide: https://speakerdeck.com/tagomoris/namespace-what-and-why
- The talk video: (will be added here when it's published)
This FAQ is written by tagomoris. This FAQ explains my own understanding and nothing are fixed for now (May 20, 2024).
No.
I still be positive to rename the name "Namespace" because now it separates not only names, but also class/module definitions (method, constants, class/module instance variables, and many others). But, at the same time, common english words can't be used because it will conflict to existing names in libraries or applications. (Wow, Namespace is a feature to solve such situations!)
Please let me know if you have a great idea about the name of this feature.
I have no idea, but I'm still working hard to finish my implementation and to make it ready for merge. Once I finish it, I'll ask Matz whether it's accepted or rejected.
I hear Matz said this, is it true?: "Once it gets merged into Ruby, I think it would become Ruby 4.0"
Yes. I (and many people) heard it at the closing keynote of RubyKaigi 2024.
But, probably, you misunderstood it. (See the item below...)
No.
(Matz and I talked to clear this after the keynote):
Package feature (kind of high level API of Namespace) is the key for Ruby 4.0, and the Namespace on read is a kind of low level API. If Namespace on read is merged into Ruby, it'll be an experimental feature at first, and Ruby 4.0 needs the design and implementation of the high level API.
Yes. My (tagomoris's) middle-term goal is to host a full-featured web applications (e.g., Ruby on Rails applications) in a namespace, and also host multiple applications in multiple namespace on a Ruby process.
My short-term goal is to implement Namespace as an optional/experimental feature and to be merged into Ruby. It will not support Ruby on Rails applications at first (because ActiveSupport::Autload conflicts with Namespace for now, and it can't be resolve on Namespace's side). After the merge, we'll be able to try running various libraris and applications in it.
The long-term goal is to design/implement the Package (high-level) API, but maybe other people will have their own idea, opinion, design and implementation about it. I don't think I'll be only a proposer of it.
No. Never.
The purpose/feature/benefit of Refinements are completely different from the Namespace's one. So that Namespace never replace Refinements. (And I love Refinements :D)
Many things! But unfortunately, not for just now. Now I'm working on the bunch of C code and the CRuby internals. It's not so easy to understand related things quickly unless you're long-term CRuby committer.
But once the Namespace on read will be merged into Ruby (I hope it comes true), there are SO MANY THINGS. We need to:
- check libraries run well in namespace
- check applications run well in namespace
- write patches of namespace
- add many test cases of namespace
- write patches for libraries (for example, ActiveSupport, Zeitwerk) to not prevent working in namespace
And so many other things should be done. I don't have so many variations of applications, so the support from many people should be the key factor of well-tested namespace.
TBD