Misc #20944
Updated by andrykonchin (Andrew Konchin) 5 months ago
~~The method Module#set_temporary_name` was introduced in Ruby 3.3. I've noticed a surprising behaviour when a temporary name is assigned to an anonymous module (that has nested non-anonymous modules) and then `Module#set_temporary_name` called with `nil`. The name of the nested module initially was fully qualified (e.g. `#<Module:0x000000010cc5a280>::N`) but after `set_temporary_name(nil)` call it becomes `nil`.~~ `nil`. ~~Example Example (from ruby/spec):~~ ruby/spec): ```ruby m = Module.new module m::N; end m::N.name # => #<Module:0x...>::N m::N.set_temporary_name("fake_name") m::N.name # => "fake_name" m::N.set_temporary_name(nil) m::N.name # => nil <==== questionable behaviour ``` ~~I I would expect a nested module name to have the initial value `#<Module:0x000000010cc5a280>::N` at the end.~~ end. ~~The The documentation states:~~ states: > If the given name is nil, the module becomes anonymous again. ~~So So I would expect all the effects of setting a (non-nil) temporary name should be also rolled back.~~ back. ~~Linked Linked issue https://bugs.ruby-lang.org/issues/19521~~ https://bugs.ruby-lang.org/issues/19521 ```