CARVIEW |
Select Language
HTTP/2 200
x-amz-id-2: MY9CAQ02WP5Bs6TjYcT/G+nT0jgS0vWEYYZYrYIzt62/0pwIVnj/sYmNnuJmhee7yovIwfWH/dSiipH8S/0ZOy9ns/snYTIy
x-amz-request-id: DX0N9A0BCRDTSAWT
last-modified: Sat, 10 May 2025 09:20:42 GMT
etag: "d7b63442251f12cec651c82153f27eb2"
x-amz-server-side-encryption: AES256
server: AmazonS3
content-encoding: gzip
via: 1.1 varnish, 1.1 varnish
content-type: text/plain; charset=utf-8
accept-ranges: bytes
age: 0
date: Thu, 24 Jul 2025 05:57:39 GMT
x-served-by: cache-tyo11967-TYO, cache-bom-vanm7210030-BOM
x-cache: MISS, MISS
x-cache-hits: 0, 0
x-timer: S1753336659.452060,VS0,VE331
vary: Accept-Encoding
content-length: 847
From: "fxn (Xavier Noria) via ruby-core"
Date: 2025-05-10T09:12:08+00:00
Subject: [ruby-core:121973] [Ruby Bug#21322] Namespaces and builtin classes as arguments and return values
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/