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 #1

Updated by nobu (Nobuyoshi Nakada) over 13 years ago

  • Category changed from core to doc

=begin

=end

Actions #2

Updated by runpaint (Run Paint Run Run) over 13 years ago

=begin

Category changed from core to DOC

Assuming this means the docs are at fault, the attached removes the last sentence "Predefined classes and singleton objects (such as true) cannot be removed." on the basis that my above description proves the first clause wrong, and the latter is implied by the fact that methods such as #constants don't regard true as a constant, either.
=end

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 13 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r29519.
Run Paint, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0