Skip to content

Commit 1d26b3a

Browse files
committed
Reformat the reloaders.
1 parent b13d3a9 commit 1d26b3a

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

md/ruby-box-reload.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Ruby lives in a single global object space. Classes, modules, and constants can see each other, reopen each other, and override each other freely. This is one of Ruby’s greatest design strengths: it enables expressive DSLs, powerful metaprogramming, and a level of flexibility that few languages can match. At the same time, it comes with a cost. When everything is global, isolation is difficult, and undoing already executed code — especially code that has already been loaded — quickly becomes problematic.
22

3-
Ruby developers value fast feedback loops, yet restarting a web server breaks flow, and safely reloading code inside a long-running process is fragile by nature. Once a file is loaded or a constant is defined, the runtime offers no simple way to rewind that state. Current reloading tools tackle this in different ways: <img src="https://avatars.githubusercontent.com/u/3387?v=4" class="avatar"> [Xavier Noria's (@fxn)](https://github.com/fxn) [Zeitwerk](https://github.com/fxn/zeitwerk) tracks and unloads all reloadable constants on every change, <img src="https://avatars.githubusercontent.com/u/3846?v=4" class="avatar"> [Jeremy Evans's (@jeremyevans)](https://github.com/jeremyevans) [rack-unreloader](https://github.com/jeremyevans/rack-unreloader) selectively unloads only the constants that changed, and <img src="https://avatars.githubusercontent.com/u/404?v=4" class="avatar"> [Ryan Tomayko's (@rtomayko)](https://github.com/rtomayko) [shotgun](https://github.com/rtomayko/shotgun) forks the process and uses IPC (inter-process communication) to handle each request in isolation. They are effective, but they all fight Ruby's shared global object space. With [`Ruby::Box`](https://docs.ruby-lang.org/en/4.0/Ruby/Box.html), there's a different approach — load code in isolation, use it, and discard the entire world afterwards.
3+
Ruby developers value fast feedback loops, yet restarting a web server breaks flow, and safely reloading code inside a long-running process is fragile by nature. Once a file is loaded or a constant is defined, the runtime offers no simple way to rewind that state.
4+
5+
Current reloading tools tackle this in different ways:
6+
- <img src="https://avatars.githubusercontent.com/u/3387?v=4" class="avatar"> [Xavier Noria's (@fxn)](https://github.com/fxn) [Zeitwerk](https://github.com/fxn/zeitwerk) tracks and unloads all reloadable constants on every change
7+
- <img src="https://avatars.githubusercontent.com/u/3846?v=4" class="avatar"> [Jeremy Evans's (@jeremyevans)](https://github.com/jeremyevans) [rack-unreloader](https://github.com/jeremyevans/rack-unreloader) selectively unloads only the constants that changed
8+
- <img src="https://avatars.githubusercontent.com/u/404?v=4" class="avatar"> [Ryan Tomayko's (@rtomayko)](https://github.com/rtomayko) [shotgun](https://github.com/rtomayko/shotgun) forks the process and uses IPC (inter-process communication) to handle each request in isolation
9+
10+
They are effective, but they all fight Ruby's shared global object space. With [`Ruby::Box`](https://docs.ruby-lang.org/en/4.0/Ruby/Box.html), there's a different approach — load code in isolation, use it, and discard the entire world afterwards.
411

512
---
613

writings.atom

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</author>
77
<id>https://rubyelders.com/writings.html</id>
88
<title>Ruby Elders&#39; writings</title>
9-
<updated>2026-01-25T22:38:48+01:00</updated>
9+
<updated>2026-01-26T00:56:19+01:00</updated>
1010
<entry>
1111
<id>https://rubyelders.com/writings/2026-01-ruby-box-reload.html</id>
1212
<link href="https://rubyelders.com/writings/2026-01-ruby-box-reload.html"/>
@@ -38,5 +38,5 @@
3838
<updated>2025-08-12T00:00:00+02:00</updated>
3939
<dc:date>2025-08-12T00:00:00+02:00</dc:date>
4040
</entry>
41-
<dc:date>2026-01-25T22:38:48+01:00</dc:date>
41+
<dc:date>2026-01-26T00:56:19+01:00</dc:date>
4242
</feed>

writings/2026-01-ruby-box-reload.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,19 @@ <h1>Ruby::Box: Rethinking Code Reloading with Isolated Namespaces</h1>
8787

8888
<p>Ruby lives in a single global object space. Classes, modules, and constants can see each other, reopen each other, and override each other freely. This is one of Ruby’s greatest design strengths: it enables expressive DSLs, powerful metaprogramming, and a level of flexibility that few languages can match. At the same time, it comes with a cost. When everything is global, isolation is difficult, and undoing already executed code — especially code that has already been loaded — quickly becomes problematic.</p>
8989

90-
<p>Ruby developers value fast feedback loops, yet restarting a web server breaks flow, and safely reloading code inside a long-running process is fragile by nature. Once a file is loaded or a constant is defined, the runtime offers no simple way to rewind that state. Current reloading tools tackle this in different ways: <img src="https://avatars.githubusercontent.com/u/3387?v=4" class="avatar"> <a href="https://github.com/fxn" target="_blank" rel="nofollow noopener">Xavier Noria’s (@fxn)</a> <a href="https://github.com/fxn/zeitwerk" target="_blank" rel="nofollow noopener">Zeitwerk</a> tracks and unloads all reloadable constants on every change, <img src="https://avatars.githubusercontent.com/u/3846?v=4" class="avatar"> <a href="https://github.com/jeremyevans" target="_blank" rel="nofollow noopener">Jeremy Evans’s (@jeremyevans)</a> <a href="https://github.com/jeremyevans/rack-unreloader" target="_blank" rel="nofollow noopener">rack-unreloader</a> selectively unloads only the constants that changed, and <img src="https://avatars.githubusercontent.com/u/404?v=4" class="avatar"> <a href="https://github.com/rtomayko" target="_blank" rel="nofollow noopener">Ryan Tomayko’s (@rtomayko)</a> <a href="https://github.com/rtomayko/shotgun" target="_blank" rel="nofollow noopener">shotgun</a> forks the process and uses IPC (inter-process communication) to handle each request in isolation. They are effective, but they all fight Ruby’s shared global object space. With <a href="https://docs.ruby-lang.org/en/4.0/Ruby/Box.html" target="_blank" rel="nofollow noopener"><code>Ruby::Box</code></a>, there’s a different approach — load code in isolation, use it, and discard the entire world afterwards.</p>
90+
<p>Ruby developers value fast feedback loops, yet restarting a web server breaks flow, and safely reloading code inside a long-running process is fragile by nature. Once a file is loaded or a constant is defined, the runtime offers no simple way to rewind that state.</p>
91+
92+
<p>Current reloading tools tackle this in different ways:</p>
93+
<ul>
94+
<li>
95+
<img src="https://avatars.githubusercontent.com/u/3387?v=4" class="avatar"> <a href="https://github.com/fxn" target="_blank" rel="nofollow noopener">Xavier Noria’s (@fxn)</a> <a href="https://github.com/fxn/zeitwerk" target="_blank" rel="nofollow noopener">Zeitwerk</a> tracks and unloads all reloadable constants on every change</li>
96+
<li>
97+
<img src="https://avatars.githubusercontent.com/u/3846?v=4" class="avatar"> <a href="https://github.com/jeremyevans" target="_blank" rel="nofollow noopener">Jeremy Evans’s (@jeremyevans)</a> <a href="https://github.com/jeremyevans/rack-unreloader" target="_blank" rel="nofollow noopener">rack-unreloader</a> selectively unloads only the constants that changed</li>
98+
<li>
99+
<img src="https://avatars.githubusercontent.com/u/404?v=4" class="avatar"> <a href="https://github.com/rtomayko" target="_blank" rel="nofollow noopener">Ryan Tomayko’s (@rtomayko)</a> <a href="https://github.com/rtomayko/shotgun" target="_blank" rel="nofollow noopener">shotgun</a> forks the process and uses IPC (inter-process communication) to handle each request in isolation</li>
100+
</ul>
101+
102+
<p>They are effective, but they all fight Ruby’s shared global object space. With <a href="https://docs.ruby-lang.org/en/4.0/Ruby/Box.html" target="_blank" rel="nofollow noopener"><code>Ruby::Box</code></a>, there’s a different approach — load code in isolation, use it, and discard the entire world afterwards.</p>
91103

92104
<hr>
93105

0 commit comments

Comments
 (0)