[#122258] [Ruby Misc#21367] Remove link to ruby-doc.org from www.ruby-lang.org/en/documentation/ — "p8 (Petrik de Heus) via ruby-core" <ruby-core@...>
Issue #21367 has been reported by p8 (Petrik de Heus).
11 messages
2025/05/23
[ruby-core:121981] [Ruby Bug#21317] Namespaces leak with object IDs
From:
"Eregon (Benoit Daloze) via ruby-core" <ruby-core@...>
Date:
2025-05-10 11:13:05 UTC
List:
ruby-core #121981
Issue #21317 has been updated by Eregon (Benoit Daloze). Full reproducer, showing that even though `Object` is the same reference in all namespaces it can have different constants in different namespaces, but only if calling `constants` in that namespace: ``` $ RUBY_NAMESPACE=1 ruby -ve 'ns = Namespace.new; File.write "ns.rb", "O = Object; OC = Object.constants"; ns.require "./ns"; p Object.equal?(ns::O); p Object.constants == ns::OC; p Object.constants == ns::Object.constants' ruby 3.5.0dev (2025-05-10T07:50:29Z namespace-on-read-.. bd4f57f96b) +PRISM [x86_64-linux] ruby: warning: Namespace is experimental, and the behavior may change in the future! See doc/namespace.md for know issues, etc. true false true ``` I think this is expected behavior for Namespace so not sure it's worth reopening. It does mean that with Namespace even though two objects (specifically core classes and modules) might be equal they are actually different when looked at in different namespaces. ---------------------------------------- Bug #21317: Namespaces leak with object IDs https://bugs.ruby-lang.org/issues/21317#change-113098 * Author: fxn (Xavier Noria) * Status: Closed * 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/