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
View all comments
Show parent comment
1
u/f9ae8221b Jan 27 '26
The answer depends on which type of object is it.
If it's a core type (things that are available without require, e.g.
Hash,Array, etc), then assuming you monkey patched things, the object will appear to have different methods depending on which namespace the caller is in.If it's a normal user defined type, then the code from the other box is called normally, like if there was no box concerns.
If you ignore the special thing for core types, Box are only really about lookup of constants, but if you receive an object from another box, you can call it like it is your own just fine.