This is a Ruby Change Request.
http://rcrchive.net/rcrs/19
Ruby lacks a TOPLEVEL_OBJECT constant, which provides access to the
object resulting from this Ruby expression:
eval( ‘self’, ::TOPLEVEL_BINDING )
That object is a built-in object of the Ruby programming language,
which should be accessible from any point in Ruby code. It is
well-suited to be assigned to a constant. This constant assignment is
comparable to TOPLEVEL_BINDING, in that, while any library could
assign the value to a constant, it is an object inherent to the Ruby
programming language, and therefore should be assigned to a constant
by the core library.
Specifically, a use case where I found the need to assign
TOPLEVEL_OBJECT was in a tracing program, where it was helpful to
exclude certain objects from being traced. TOPLEVEL_OBJECT needed to
be referenced to be added to the list of exclusions. As previously
stated, it can be trivially assigned to TOPLEVEL_OBJECT, or found
dynamically via it’s definition above, it should be included in the
Ruby core, and it is inappropriate for any other library to assign it.
Daniel Brumbaugh K.