Actions
Bug #21322
openNamespaces and builtin classes as arguments and return values
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).
Actions
Like0
Like0Like0Like0Like0