Issue #4971 has been reported by Shugo M…
Bug #4971: Module#class_variables
Author: Shugo M.
Status: Open
Priority: Normal
Assignee: Yukihiro M.
Category: core
Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2011-06-16 trunk 32113) [i686-linux]
Ruby 1.9だとModule#class_variablesはスーパークラスのクラス変数を返しませんが、仕様でしょうか?
class Foo
@@foo = 123
end
class Bar < Foo
@@bar = 456
end
p Bar.class_variables #=> 1.8では[“@@bar”, “@@foo”], 1.9では[:@@bar]
commit logには
* variable.c (rb_mod_class_variables): class variables are no longer
inherited. [ruby-dev:23808]
と書いてあるのですが、当時のクラス変数の仕様って今の1.8とも1.9とも違う
仕様だったりするでしょうか。
Bar.class_variable_get(:@@foo)で値は取れるので、class_variablesで:@@fooを
返してもよい気がするのですが。
Issue #4971 has been updated by Motohiro KOSAKI.
うーん、議論が止まっているように見えて遺憾であります。前田さん、これって治らないとどのぐらい致命的でしょうか。
Bug #4971: Module#class_variables
Author: Shugo M.
Status: Open
Priority: Normal
Assignee: Yukihiro M.
Category: core
Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2011-06-16 trunk 32113) [i686-linux]
Ruby 1.9だとModule#class_variablesはスーパークラスのクラス変数を返しませんが、仕様でしょうか?
class Foo
@@foo = 123
end
class Bar < Foo
@@bar = 456
end
p Bar.class_variables #=> 1.8では[“@@bar”, “@@foo”], 1.9では[:@@bar]
commit logには
* variable.c (rb_mod_class_variables): class variables are no longer
inherited. [ruby-dev:23808]
と書いてあるのですが、当時のクラス変数の仕様って今の1.8とも1.9とも違う
仕様だったりするでしょうか。
Bar.class_variable_get(:@@foo)で値は取れるので、class_variablesで:@@fooを
返してもよい気がするのですが。
$B$&!<$s!“5DO@$,;_$^$C$F$$$k$h$&$K8+$($F0d48$G$”$j$^$9!#A0ED$5$s!"$3$l$C$F<#$i$J$$$H$I$N$0$i$$CWL?E*$G$7$g$&$+!#(B
$B:#$^$GJ86g$,=P$J$+$C$?$H$$$&$3$H$O$?$V$s$"$^$j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 KOSAKI Motohiro
[email protected]:
(7/17$B$“$?$j!K$0$i$$$^$G$K=P$F$/$k$J$i!”(B1.9.3 $B%"%j(B
$B$0$i$$$N%9%1%8%e!<%k463P$G$7$?!#(B
$B$I$A$i$K$7$m$^$D$b$H$5$s$,L5H?1~$N$^$^$@$H?=$7Lu$"$j$^$;$s$,<+F0E*$K(B1.9.4$B$K%9%j%C%W$H$$$&$3$H$K$J$j$^$9!#$d!"A0ED$5$s$,6/8"H/F0$9$k$J$i=>$$$^$9$,!#(B
$B$$$d!"$=$s$J8"8B$J$$$G$9!D!#(B
$B$$$C$?$s(B1.8$B$KLa$9$H$$$&$N$b9M$($^$7$?$,!“$=$l$@$H$=$N%/%i%9$KDj5A$5$l$?(B
$B%/%i%9JQ?t$@$1$N0lMw$r<h$k<jCJ$,$J$/$J$k$N$G!”(B1.9.4$B$K@hAw$j$7$?J}$,$$$$(B
$B5$$,$7$^$9!#(B
Issue #4971 has been updated by Shugo M…
Target version changed from 1.9.3 to 1.9.x
Motohiro KOSAKI wrote:
うーん、議論が止まっているように見えて遺憾であります。前田さん、これって治らないとどのぐらい致命的でしょうか。
今まで文句が出なかったということはたぶんあまり使われていないと思うので、targetを1.9.xに
しましょうか。
個人的には、Module#class_variablesもModule#constantsのように引数でコントロールできる
ようにする(デフォルトではスーパークラスも探索する)のがよいと思います。
Bug #4971: Module#class_variables
Author: Shugo M.
Status: Open
Priority: Normal
Assignee: Yukihiro M.
Category: core
Target version: 1.9.x
ruby -v: ruby 1.9.3dev (2011-06-16 trunk 32113) [i686-linux]
Ruby 1.9だとModule#class_variablesはスーパークラスのクラス変数を返しませんが、仕様でしょうか?
class Foo
@@foo = 123
end
class Bar < Foo
@@bar = 456
end
p Bar.class_variables #=> 1.8では[“@@bar”, “@@foo”], 1.9では[:@@bar]
commit logには
* variable.c (rb_mod_class_variables): class variables are no longer
inherited. [ruby-dev:23808]
と書いてあるのですが、当時のクラス変数の仕様って今の1.8とも1.9とも違う
仕様だったりするでしょうか。
Bar.class_variable_get(:@@foo)で値は取れるので、class_variablesで:@@fooを
返してもよい気がするのですが。
Issue #4971 has been updated by Shugo M…
File class_variables.diff added
前田です。
Shugo M. wrote:
個人的には、Module#class_variablesもModule#constantsのように引数でコントロールできる
ようにする(デフォルトではスーパークラスも探索する)のがよいと思います。
この方針で作ったパッチを添付しておきます。
trunkならRails風に勝手にcommitしてもいいんですかね。
Bug #4971: Module#class_variables
Author: Shugo M.
Status: Open
Priority: Normal
Assignee: Yukihiro M.
Category: core
Target version: 1.9.x
ruby -v: -
Ruby 1.9だとModule#class_variablesはスーパークラスのクラス変数を返しませんが、仕様でしょうか?
class Foo
@@foo = 123
end
class Bar < Foo
@@bar = 456
end
p Bar.class_variables #=> 1.8では[“@@bar”, “@@foo”], 1.9では[:@@bar]
commit logには
* variable.c (rb_mod_class_variables): class variables are no longer
inherited. [ruby-dev:23808]
と書いてあるのですが、当時のクラス変数の仕様って今の1.8とも1.9とも違う
仕様だったりするでしょうか。
Bar.class_variable_get(:@@foo)で値は取れるので、class_variablesで:@@fooを
返してもよい気がするのですが。
$B$^$D$b$H$5$s(B
$BA0ED$G$9!#(B
$B$3$NJ}?K$G:n$C$?%Q%C%A$rE:IU$7$F$*$-$^$9!#(B
trunk$B$J$i(BRails$BIw$K>!<j$K(Bcommit$B$7$F$b$$$$$s$G$9$+$M!#(B
$B$3$5$-$5$s$K!V(BMatz$B$,(Back$B$7$M!<$+$i(Breject$B!"$=$l$,479T$@!W$H8@$o$l$F$7$^$C$?$N$G!"(B
$B>e5-$N$h$&$J=$@5$G$h$$$+$I$&$+3NG’$r$*4j$$$7$^$9!#(B
$B$($($($($($($(!#$J$K$3$N0U?^E*$J6J2r(B(><;;
Issue #4971 has been updated by Shugo M…
まつもとさん
前田です。
Shugo M. wrote:
個人的には、Module#class_variablesもModule#constantsのように引数でコントロールできる
ようにする(デフォルトではスーパークラスも探索する)のがよいと思います。
この方針で作ったパッチを添付しておきます。
trunkならRails風に勝手にcommitしてもいいんですかね。
こさきさんに「Matzがackしねーからreject、それが慣行だ」と言われてしまったので、
上記のような修正でよいかどうか確認をお願いします。
Bug #4971: Module#class_variables
Author: Shugo M.
Status: Open
Priority: Normal
Assignee: Yukihiro M.
Category: core
Target version: 1.9.x
ruby -v: -
Ruby 1.9だとModule#class_variablesはスーパークラスのクラス変数を返しませんが、仕様でしょうか?
class Foo
@@foo = 123
end
class Bar < Foo
@@bar = 456
end
p Bar.class_variables #=> 1.8では[“@@bar”, “@@foo”], 1.9では[:@@bar]
commit logには
* variable.c (rb_mod_class_variables): class variables are no longer
inherited. [ruby-dev:23808]
と書いてあるのですが、当時のクラス変数の仕様って今の1.8とも1.9とも違う
仕様だったりするでしょうか。
Bar.class_variable_get(:@@foo)で値は取れるので、class_variablesで:@@fooを
返してもよい気がするのですが。
Issue #4971 has been updated by matz (Yukihiro M.).
Assignee changed from matz (Yukihiro M.) to nobu (Nobuyoshi
Nakada)
あ、気がついてなかった。constantsと同じような挙動を希望します。
って言ったら中田さんがやってくれるかな。
Bug #4971: Module#class_variables
Author: shugo (Shugo M.)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi N.)
Category: core
Target version: 2.0.0
ruby -v: -
Ruby 1.9だとModule#class_variablesはスーパークラスのクラス変数を返しませんが、仕様でしょうか?
class Foo
@@foo = 123
end
class Bar < Foo
@@bar = 456
end
p Bar.class_variables #=> 1.8では[“@@bar”, “@@foo”], 1.9では[:@@bar]
commit logには
* variable.c (rb_mod_class_variables): class variables are no longer
inherited. [ruby-dev:23808]
と書いてあるのですが、当時のクラス変数の仕様って今の1.8とも1.9とも違う
仕様だったりするでしょうか。
Bar.class_variable_get(:@@foo)で値は取れるので、class_variablesで:@@fooを
返してもよい気がするのですが。
Issue #4971 has been updated by shugo (Shugo M.).
まつもとさん、この件ですがどうでしょうか?
shugo (Shugo M.) wrote:
前田です。
Shugo M. wrote:
個人的には、Module#class_variablesもModule#constantsのように引数でコントロールできる
ようにする(デフォルトではスーパークラスも探索する)のがよいと思います。
この方針で作ったパッチを添付しておきます。
trunkならRails風に勝手にcommitしてもいいんですかね。
Bug #4971: Module#class_variables
Author: shugo (Shugo M.)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro M.)
Category: core
Target version: 2.0.0
ruby -v: -
Ruby 1.9だとModule#class_variablesはスーパークラスのクラス変数を返しませんが、仕様でしょうか?
class Foo
@@foo = 123
end
class Bar < Foo
@@bar = 456
end
p Bar.class_variables #=> 1.8では[“@@bar”, “@@foo”], 1.9では[:@@bar]
commit logには
* variable.c (rb_mod_class_variables): class variables are no longer
inherited. [ruby-dev:23808]
と書いてあるのですが、当時のクラス変数の仕様って今の1.8とも1.9とも違う
仕様だったりするでしょうか。
Bar.class_variable_get(:@@foo)で値は取れるので、class_variablesで:@@fooを
返してもよい気がするのですが。