CARVIEW |
Select Language
HTTP/2 200
x-amz-id-2: ROMzL9KGwkaPtXBd3xuPaXKWsX8inweFVgFATuOLwZd3r6wyKsF8hxTQ7KLSmaNS0UE+NysXBP+N5KVPlz4iDl0tcK9amU3m6h4Y1BuvnmA=
x-amz-request-id: 0GK4J814KN0FS07X
last-modified: Thu, 22 May 2025 23:21:16 GMT
etag: "e774786e9315e9ebb195b096fb3284d9"
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:25:10 GMT
x-served-by: cache-tyo11946-TYO, cache-bom-vanm7210062-BOM
x-cache: MISS, MISS
x-cache-hits: 0, 0
x-timer: S1753334710.860880,VS0,VE357
vary: Accept-Encoding
content-length: 757
From: "tenderlovemaking (Aaron Patterson) via ruby-core"
Date: 2025-05-22T23:17:11+00:00
Subject: [ruby-core:122240] [Ruby Bug#21363] `Namespace.current` should always return the Namespace in which it was defined
Issue #21363 has been reported by tenderlovemaking (Aaron Patterson).
----------------------------------------
Bug #21363: `Namespace.current` should always return the Namespace in which it was defined
https://bugs.ruby-lang.org/issues/21363
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-05-22T23:07:21Z rm-assertion 17e71c7a24) +PRISM [arm64-darwin24]
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
I think `Namespace.current` should always return the namespace in which it was defined. Here is an example to demonstrate what I mean:
```ruby
File.binwrite("ns.rb", <<-RUBY)
# namespace 3
module M
def self.test
p Namespace.current
end
TEST = -> {
p Namespace.current
}
end
RUBY
ns = Namespace.new
ns.load "./ns.rb"
p Namespace.current
ns::M.test
ns::M::TEST.call
```
I expect the output of `ns::M.test` and `ns::M::TEST.call` to be the same. Instead the output is like this:
```
#
#
#
```
I think a method and lambda defined in the same namespace should return the same value for `Namespace.current`
--
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/