Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringIO はもはや Data を継承していない #2880

Open
scivola opened this issue Apr 24, 2024 · 0 comments
Open

StringIO はもはや Data を継承していない #2880

scivola opened this issue Apr 24, 2024 · 0 comments

Comments

@scivola
Copy link
Contributor

scivola commented Apr 24, 2024

https://docs.ruby-lang.org/ja/latest/class/StringIO.html
によれば StringIO が Data を継承していることになっていますが,これはかなり昔のことであるようです。

いつ継承しなくなったのかきちんと調べていませんが,以下の実験によれば,Ruby 2.4.10 のときは Data を継承しており,Ruby 2.7.8 では継承していません。

Ruby 2.4.10:

% ruby -r stringio -e "p StringIO.ancestors"
[StringIO, IO::generic_writable, IO::generic_readable, Enumerable, Data, Object, Kernel, BasicObject]

Ruby 2.7.8:

% ruby -r stringio -e "p StringIO.ancestors"
[StringIO, IO::generic_writable, IO::generic_readable, Enumerable, Object, Kernel, BasicObject]

Ruby 3.3.0:

% ruby -r stringio -e "p StringIO.ancestors"
[StringIO, IO::generic_writable, IO::generic_readable, Enumerable, Object, Kernel, BasicObject]

Ruby 2.x までの Data は影のような存在だったのでリファレンスマニュアルのこの誤りは大した問題ではなかったと思いますが,Ruby 3.0.0 でいったん廃止されたあと Ruby 3.2.0 で同名のクラスが導入されたために,重大問題になってしまいました。(実際,現行のリファレンスを信じて 1 時間溶かしました)

どこを直せばよいか分からないので,プルリクエスト作れません。すみません。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant