[Ruby 1.9 - Bug #4971][Open] Module#class_variables

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$,=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G$9!#(B

2011$BG/(B7$B7n(B8$BF|(B22:11 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を
返してもよい気がするのですが。

Issue #4971 has been updated by elninorian (menuju sukses sukses).

http://www.howtogetaflatstomachforgirls.com/
http://www.howtogetaflatstomachforgirls.com/lose-weight/lose-weight-teenage-girls/
http://www.howtogetaflatstomachforgirls.com/uncategorized/reviews-flat-belly-diet-book-work/
http://www.howtogetaflatstomachforgirls.com/diet/diet-rich-cellulose/
http://www.howtogetaflatstomachforgirls.com/belly-fat/flat-belly-menopause/
http://www.howtogetaflatstomachforgirls.com/flat-belly/flat-belly-menu-plan-vegetarians/
http://www.howtogetaflatstomachforgirls.com/flat-stomach-for-girls/how-to-get-a-flat-stomach-for-girls-in-2-weeks/
http://www.howtogetaflatstomachforgirls.com/have-a-flat-stomach-for-girls/how-to-have-a-flat-stomach-for-girls-a/
http://www.howtogetaflatstomachforgirls.com/weight-loss-secrets/the-secret-to-losing-weight/
http://www.howtogetaflatstomachforgirls.com/exercise-to-slim-legs/exercise-to-slim-legs/
http://www.howtogetaflatstomachforgirls.com/weight-loss-secrets/lose-6-pounds-in-a-week/
http://www.howtogetaflatstomachforgirls.com/diet/ketogenic-diet-risks/
http://www.howtogetaflatstomachforgirls.com/lose-pounds/lose-6-pounds-in-two-weeks/
http://www.howtogetaflatstomachforgirls.com/belly-fat/belly-fat-under-belly-button/
http://www.howtogetaflatstomachforgirls.com/flat-stomach-for-girls/how-to-get-a-flat-stomach-for-girls-fast/
http://www.howtogetaflatstomachforgirls.com/a-flat-stomach/flat-stomach-in-a-month/
http://www.howtogetaflatstomachforgirls.com/belly-fat/flatten-belly-fast/
http://www.howtogetaflatstomachforgirls.com/abs/how-to-get-abs-for-girls-women/
http://www.howtogetaflatstomachforgirls.com/flat-stomach-fast-for-girls/how-to-get-a-flat-stomach-for-girls-a/
http://www.howtogetaflatstomachforgirls.com/flat-belly/flat-belly-solution/
http://www.howtogetaflatstomachforgirls.com/exercises-work/exercises-work-flat-stomach/
http://www.howtogetaflatstomachforgirls.com/a-flat-stomach/foods-flat-stomach/
http://www.howtogetaflatstomachforgirls.com/flat-stomach-diet-does-work/flat-stomach-diet-work/
http://www.howtogetaflatstomachforgirls.com/cardio-training-tips-workout/cardio-training-tips-workout-flat-stomach/
http://www.howtogetaflatstomachforgirls.com/bonus-buy-flat-stomach/bonus-buy-flat-stomach-diet-does-work/
http://www.howtogetaflatstomachforgirls.com/flat-stomach-ebook/flat-stomach-ebook-download/
http://www.howtogetaflatstomachforgirls.com/flat-stomach-program/flat-stomach-programme-exercise-training-workout-gym-2012/
http://www.howtogetaflatstomachforgirls.com/abs/how-to-have-defined-abs/
http://www.howtogetaflatstomachforgirls.com/weight-loss-secrets/lose-weight-while-walking/
http://www.howtogetaflatstomachforgirls.com/stomach-for-girls-in-a-week/how-to-get-a-flat-stomach-for-girls-in-a-week-for-teenagers/
http://www.howtogetaflatstomachforgirls.com/secrets-to-lose-weight-fast/secrets-to-lose-weight-fast/
http://www.howtogetaflatstomachforgirls.com/exercises-for-flat-stomach/how-to-get-a-flat-stomach-for-girls-exercises/
http://www.howtogetaflatstomachforgirls.com/to-get-a-flat-stomach-at-home-for-girls/how-to-get-a-flat-stomach-at-home-for-girls-fast-for-girls-at-home/
http://www.howtogetaflatstomachforgirls.com/tips-for-slimming-stomach/tips-for-slimming-stomach-weigh-your-belly/
http://www.howtogetaflatstomachforgirls.com/flat-stomach-for-girls/flat-stomach-for-girls/
http://www.howtogetaflatstomachforgirls.com/a-flat-stomach/a-flat-stomach-the-ideal-diet-and-exercise-system-beautiful-belly/
http://www.howtogetaflatstomachforgirls.com/belly-fat/flat-belly-menu-plan/
http://www.howtogetaflatstomachforgirls.com/flat-belly/menu-plan-flat-belly-diet/
http://www.howtogetaflatstomachforgirls.com/weight-loss-secrets/lose-3-kg-in-3-days-how-to-lose-3-kg-in-3-days/
http://www.howtogetaflatstomachforgirls.com/diet/moerman-diet/
http://www.howtogetaflatstomachforgirls.com/weight-loss-secrets/lose-4-kg-how-to-lose-4-kg/
http://www.howtogetaflatstomachforgirls.com/belly-fat/how-to-lose-belly-fat-swimming/
http://www.howtogetaflatstomachforgirls.com/belly-fat/fast-flatten-belly-fast/
http://www.howtogetaflatstomachforgirls.com/how-to-lose-3-kg-in-a-month/how-to-lose-3-kg-in-a-month/
http://www.howtogetaflatstomachforgirls.com/flat-stomach-for-girls/girls-with-flat-stomach/
http://www.howtogetaflatstomachforgirls.com/flat-stomach-for-girls/how-long-does-it-take-to-get-a-flat-stomach-for-girls/
http://www.howtogetaflatstomachforgirls.com/how-do-i-lose-weight-in-a-week/how-do-i-lose-weight-in-a-week/

http://www.fatburningfoodsformen1.com/belly-fat-exercises-for-men.htm
http://www.fatburningfoodsformen1.com/abs-exercises-for-men.htm
http://www.fatburningfoodsformen1.com/green-tea-burn-belly-fat.htm
http://www.fatburningfoodsformen1.com/belly-fat-exercises-for-men.htm
http://www.fatburningfoodsformen1.com/the-man-diet-free-download.htm


Bug #4971: Module#class_variables
https://bugs.ruby-lang.org/issues/4971#change-31066

Author: shugo (Shugo M.)
Status: Closed
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を
返してもよい気がするのですが。