Project

General

Profile

Actions

Bug #21322

open

Namespaces and builtin classes as arguments and return values

Bug #21322: Namespaces and builtin classes as arguments and return values

Added by fxn (Xavier Noria) 6 months ago. Updated 6 months 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)

Actions

Also available in: PDF Atom