Namespaces 101

23-May-2025 79
Ruby has recently merged namespaces as an experimental feature that is disabled by default, as of this writing. This is a non-trivial development driven by @matz himself, and mainly implemented by @tagomoris, who just became a Ruby committer (🎉). The feature has been cooking for a long time, with a first ticket opened a couple of years ago (#19744) and a revised one opened just last week (#21311). There is already some documentation here, and the tickets have tons of discussions. About details, understanding the proposal, performance considerations, objections, ..., it is a bit hard to follow. In this post I'd like to present a digested summary of namespaces. I would like to give you a mental model for them so you know what is coming.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle