Chris Salzberg
Chris Salzberg
  • @shioyama

Rubyist and writer from Montreal living and working in Hakodate, Japan. I'm the author of Mobility, a pluggable translation framework for Ruby, and a committer to many open-source projects including Rails. I am a Staff engineer in the Ruby and Rails Infrastructure team at Shopify.

Multiverse Ruby

Sharing code in Ruby is like sharing stuff on the web: grab a top-level name that's free, park your stuff under it, and point to the address. Like the Internet, Ruby's constant namespace is global and reachable from anywhere.

But although it feels natural, there are serious downsides to this approach. Working in a single, shared universe makes namespace pollution a necessary fact of life; boundaries and code isolation depend on the good manners of every maintainer in your Gemfile.

In this talk, I present a gem called Im that lets you share your code without touching the global namespace at all. A fork of Zeitwerk, Im leverages new features in Ruby 3.2 to load constants onto namespaces whose roots are anonymous.

Loading this way positions each unit of code at the center of its own universe, free from name conflicts and isolated from the rest of the world. We explore how this freedom impacts the writing and sharing of code, and the benefits it unlocks for designing applications at scale.

Presentation Material

Recorded video