Project

General

Profile

Actions

Bug #21322

open

Namespaces and builtin classes as arguments and return values

Added by fxn (Xavier Noria) about 18 hours ago. Updated about 15 hours ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:121973]

Description

@tagomoris (Satoshi Tagomori) 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:

# 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).


Related issues 1 (0 open1 closed)

Related to Ruby - Bug #21317: Namespaces leak with object IDsClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0