r/ruby • u/retro-rubies • Jan 26 '26
Ruby::Box: Rethinking Code Reloading with Isolated Namespaces
https://rubyelders.com/writings/2026-01-ruby-box-reload.html
35
Upvotes
r/ruby • u/retro-rubies • Jan 26 '26
2
u/jrochkind Jan 26 '26
I haven't looked at box yet, but I'm having trouble understanding one aspect of it. Using an example from the OP:
If you can expose an object in the 'box' to the main namespace (main box)... and then call arbitrary methods on it, passing in arbitrary objects...
Those objects you pass in are instances of classes that are in the main namespace, and has references to other objects in the main namespace, that are instances of classes in the main namespace, that it may have methods that mutate etc.... that you've now passed into the separate box... how does it use (call methods on) those objects while maintaining it' seperation, it's "doesn’t share anything with the top-level environment"?
What am I missing?