Project

General

Profile

Actions

Misc #16910

closed

BasicObject is resolved in BasicObject

Added by fxn (Xavier Noria) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Assignee:
-
[ruby-core:98498]

Description

I categorized this as Misc because I do not really know if this is a bug, or perhaps I miss some special rule in the resolution of relative constants.

Basically, I would expect

class C < BasicObject
  BasicObject
end

or, even simpler,

class BasicObject
  BasicObject
end

to raise NameError.

Reason would be that top-level constants are stored in Object, which is not among the ancestors in any of the two examples above.

Is my reasoning flawed or is it a bug? If flawed, which is the correct reasoning?

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0