Namespaces 101

23-May-2025 1662
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.

Free eBook download

Download all our eBooks for free from Gumroad!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these books offer thousands of essential questions and answers across multiple languages. Download the complete collection for free from our Gumroad page. Free Ultimate Job Interview Preparation eBook collection