Project

General

Profile

Actions

Backport #621

closed

When to call Class#inherited

Added by shyouhei (Shyouhei Urabe) over 15 years ago. Updated almost 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 #1

Updated by kou (Kouhei Sutou) over 15 years ago

=begin
[ruby-dev:34639]でまつもとさんが意図的に変えたような発言をしています。
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/34639

trunkの方が「よい挙動」であることは確かでしょうね(そう思って
変えた覚えがある)。1.8も揃えたいのはやまやまですが、互換性の
問題もあるので適用するかどうかはknuさんにお任せします。

でも、放置せざるをえないかな。

=end

Actions #2

Updated by ko1 (Koichi Sasada) over 15 years ago

=begin
これ,担当が私になってるんですが,どうしたもんでしょうか.
=end

Actions #3

Updated by ko1 (Koichi Sasada) over 15 years ago

=begin
どうしたもんでしょうか.

Kouhei Sutou wrote::

チケット #621 が更新されました。 (by Kouhei Sutou)

[ruby-dev:34639]でまつもとさんが意図的に変えたような発言をしています。
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/34639

trunkの方が「よい挙動」であることは確かでしょうね(そう思って
変えた覚えがある)。1.8も揃えたいのはやまやまですが、互換性の
問題もあるので適用するかどうかはknuさんにお任せします。

でも、放置せざるをえないかな。


http://redmine.ruby-lang.org/issues/show/621


http://redmine.ruby-lang.org

--
// SASADA Koichi at atdot dot net

=end

Actions #4

Updated by naruse (Yui NARUSE) over 14 years ago

  • Category set to core
  • Status changed from Open to Assigned
  • Assignee changed from ko1 (Koichi Sasada) to knu (Akinori MUSHA)
  • Target version set to Ruby 1.8.8

=begin

  • この変更は 1.9 では仕様変更である
  • 1.8 での変更は knu さんが判断する
    =end
Actions #5

Updated by knu (Akinori MUSHA) over 14 years ago

=begin
互換性の問題はありますが、これはバグと捉えたい気がします。
生成直後に実行されないのでは、フックとしての機能が毀損されますよね。

ruby_1_8ではrb_class_initializeを「直す」ことにします。
=end

Actions #6

Updated by knu (Akinori MUSHA) over 14 years ago

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

=begin
This issue was solved with changeset r25470.
Shyouhei, 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
Like0Like0Like0Like0Like0Like0