From: "mame (Yusuke Endoh) via ruby-core" Date: 2025-05-10T05:33:58+00:00 Subject: [ruby-core:121959] [Ruby Bug#21317] Namespaces leak with object IDs Issue #21317 has been updated by mame (Yusuke Endoh). Did you actually test the code? `mod1.constants == mod2.constants` returns `true`. ``` $ cat main.rb ns = Namespace.new mod1 = Object mod2 = ns::Object p mod1 #=> Object p mod2 #=> Object p mod1.object_id == mod2.object_id #=> true p mod1.constants == mod2.constants #=> true $ RUBY_NAMESPACE=1 ./miniruby main.rb ./miniruby: warning: Namespace is experimental, and the behavior may change in the future! See doc/namespace.md for know issues, etc. Object Object true true ``` It's great that you're splitting the ticket and discussing each topic in detail. Thank you for that. That said, when creating tickets, please make sure to include the test code, what you expected to happen, and what actually happened, in the usual format. ---------------------------------------- Bug #21317: Namespaces leak with object IDs https://bugs.ruby-lang.org/issues/21317#change-113073 * Author: fxn (Xavier Noria) * Status: Open * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- Namespaces are not transparent for this program ```ruby if mod1.object_id == mod2.object_id mod1.constants == mod2.constants end ``` because it may fail for `mod1 = Object; mod2 = ns::Object`, which have the same object ID. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/