Project

General

Profile

Actions

Bug #3769

closed

Removing Predefined Constants

Added by runpaint (Run Paint Run Run) over 13 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3dev (2010-08-30 trunk 29147) [i686-linux]
Backport:
[ruby-core:31957]

Description

=begin
The documentation for Module#remove_const states "Predefined classes and singleton objects (such as true) cannot be removed", but I believe the example below illustrates that they can. Is this a documentation or implementation bug?

run@paint:~ → cat /tmp/remove_const.rb
Module.constants.grep(/(?<!Object)$/).tap do |c|
c.each {|_| Object.class_eval{ remove_const } }
p c.select{|
| Object.const_defined? _}
end
run@paint:~ → ruby -vw /tmp/remove_const.rb
ruby 1.9.3dev (2010-08-30 trunk 29147) [i686-linux]
[]
=end


Files

mod-remove-const.patch (411 Bytes) mod-remove-const.patch runpaint (Run Paint Run Run), 09/02/2010 09:32 PM

Related issues 2 (0 open2 closed)

Has duplicate Ruby master - Bug #3949: Can predefined classes be removed?Closedmatz (Yukihiro Matsumoto)10/15/2010Actions
Has duplicate Ruby master - Bug #5354: Module#remove_const documentation is confusingClosed09/23/2011Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0