Project

General

Profile

Actions

Backport #621

closed

When to call Class#inherited

Added by shyouhei (Shyouhei Urabe) about 16 years ago. Updated over 13 years ago.

Status:
Closed
[ruby-dev:36685]

Description

=begin
1.8のバグか1.9のバグかよくわからんのですが、以下のようにClass#inheritedを実行するタイミングが変わっています。

% ruby -ve'
class C
def C.inherited(d)
raise "inherited"
end
end

begin
Class.new C do
raise "new"
end
rescue
p $!
end
'
ruby 1.9.0 (2008-10-08 revision 17576) [x86_64-linux]
#<RuntimeError: inherited>

% ruby -ve'
class C
def C.inherited(d)
raise "inherited"
end
end

begin
Class.new C do
raise "new"
end
rescue
p $!
end
'
ruby 1.8.7 (2008-10-08 revision 17572) [x86_64-linux]
#<RuntimeError: new>
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0