[#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:121973] [Ruby Bug#21322] Namespaces and builtin classes as arguments and return values
From:
"fxn (Xavier Noria) via ruby-core" <ruby-core@...>
Date:
2025-05-10 09:12:08 UTC
List:
ruby-core #121973
Issue #21322 has been reported by fxn (Xavier Noria).
----------------------------------------
Bug #21322: Namespaces and builtin classes as arguments and return values
https://bugs.ruby-lang.org/issues/21322
* Author: fxn (Xavier Noria)
* Status: Open
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
@tagomoris thanks for the docs under `doc/namespace.md`.
Unless I missed it, I believe there is an edge case related to builtin classes (using the vocabulary there). Consider:
```ruby
# test.rb
ns = Namespace.new
ns.require_relative 'foo'
X = 1
ns::C.x(Object)
# foo.rb
class C
def self.x(obj)
obj::X
end
end
```
`obj::X` raises. I believe this is consistent with the feature, but maybe would deserve docs, because from the point of view of the Ruby programmer I am passing an object, no constant name resolution is happening in `foo.rb`. See what I mean?
I believe, from my tests, that something analogous happens if `ns::C.x` returns (the namespaced) `Object`. In the main namespace, you don't get the object passed up as-is.
I am also curious about how is this implemented (maybe to comment here, not necessarily in the docs).
--
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/