Bug #3769: Removing Predefined Constants
http://redmine.ruby-lang.org/issues/show/3769
Author: Run Paint Run Run
Status: Open, Priority: Low
Category: core
ruby -v: ruby 1.9.3dev (2010-08-30 trunk 29147) [i686-linux]
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]
[]
on 2010-08-30 21:27
on 2010-09-02 14:34
Issue #3769 has been updated by Run Paint Run Run.
File mod-remove-const.patch added
> 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 <i>true</i>)
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.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/3769
on 2010-10-17 04:04
Issue #3769 has been updated by Nobuyoshi Nakada. Status changed from Open to Closed % Done changed from 0 to 100 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.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.