Bug #10691
closedBad or Non-existent class names listed on 'Index of Files, Classes & Methods in Ruby' page.
Description
On this page: Index of Files, Classes & Methods in Ruby 2.2.0 (Ruby 2.2.0)
There are Classes:
I found some of the classes listed here does not exist:
Complex::compatible
fatal
unknown
Rational::compatible
What do I mean by not exist? That is if I type fatal
in irb:
irb(main):001:0> fatal
NameError: undefined local variable or method `fatal' for main:Object
from (irb):1
from /Users/Juan/.rubies/ruby-2.2.0/bin/irb:11:in `<main>'
irb(main):002:0> Fatal
NameError: uninitialized constant Fatal
from (irb):2
from /Users/Juan/.rubies/ruby-2.2.0/bin/irb:11:in `<main>'
Other versions of documentation also has this problem.
http://www.ruby-doc.org/core-2.0.0/
http://www.ruby-doc.org/core-2.1.5/
http://www.ruby-doc.org/core-2.2.0/
I want to remove it but cannot find which repository to work on.
So I report here, Thanks!
Files
Updated by jeremyevans0 (Jeremy Evans) over 5 years ago
- File fatal-doc-10691.patch fatal-doc-10691.patch added
Complex::compatible
, unknown
, Rational::compatible
were removed by Ruby 2.6.0. fatal
is still documented, but that exists even though you cannot reference it directly:
f = ObjectSpace.each_object(Class){|c| break c if c.name && c.name.downcase == c.name}
# => fatal
f.ancestors
# => [fatal, Exception, Object, Kernel, BasicObject]
The documentation for fatal
states You are not able to rescue fatal.
That appears to be incorrect:
f = ObjectSpace.each_object(Class){|c| break c if c.name && c.name.downcase == c.name}
begin
raise f
rescue f
2
end
# => 2
Attached is a patch that removes that sentence from fatal's documentation. I'm not sure if we actually want to prevent the rescuing of fatal instead, though.
Updated by nobu (Nobuyoshi Nakada) over 5 years ago
The documentation is not accurate indeed.
To be accurate, it is impossible to rescue the fatal
raised by rb_fatal
function.
Updated by nobu (Nobuyoshi Nakada) over 5 years ago
Thread.start{Thread.stop}
begin
Thread.stop
rescue Exception => fatal
p fatal.class #=> fatal
end
Updated by jeremyevans (Jeremy Evans) over 5 years ago
- Status changed from Open to Closed
Applied in changeset git|404850e13446c79fb6142f1b32b219753e5cd726.
Remove documentation that fatal cannot be rescued [ci skip]
You can rescue it:
f = ObjectSpace.each_object(Class){|c| break c if c.name == 'fatal'}
begin
raise f
rescue f
2
end # => 2
It's not a good idea to rescue fatal exceptions you didn't generate
yourself, though.
Fixes [Bug #10691]