Right. Today Ruby has essentially a global namespace, where every defined module/class/const is put in the same "global dumping ground" and can override/"monkey patch" each other.
Ruby 3.5 will introduce a new language keyword "namespace" that scopes behavior to that namespace.
class Foo
def foo; puts "foo"; end
end
namespace Bar
class Foo
def foo; puts "bar"; end
end
Foo.new.foo #=> "bar"
end
Foo.new.foo #=> "foo"
Fun times.
This is intended for isolated code loading similar to "modules" in Python or ES6, but I am worried it will be abused badly. I'm also unsure whether they will add a "use Namespace" construct...
See here: https://bugs.ruby-lang.org/issues/21311