doctree icon indicating copy to clipboard operation
doctree copied to clipboard

Ruby 2.7対応

Open pocke opened this issue 4 years ago • 6 comments

2.7の変更点をまとめてチェックリストにしました。(後半はまだちゃんと見てないから誰か見て!)

人と作業が被らないように、このIssueで宣言してから作業をしていただけるとありがたいです🙏

修正内容を調べる際は、リンク先のNEWSや、 https://techlife.cookpad.com/entry/2019/12/25/121834 などを参考にすると良いかもしれません。

言語の変更

  • [ ] パターンマッチ link
    • deconstruct_keyとかを書く必要がある?
  • [ ] キーワード引数分離 link
  • [ ] Numbered parameters link
  • [ ] proc/lambda without block is deprecated link
  • [x] beginless range link
  • [x] $;, $,の非推奨 link
  • [ ] ヒアドキュメントの区切り文字の改行禁止 link
    • これは書くことなさそう
  • [ ] flip-flopのdeprecationのrevert link
  • [ ] Comment lines can be placed between fluent dot now. link
  • [x] Calling a private method with a literal self as the receiver is now allowed. link
    • プライベートメソッドとは、みたいな説明があればその辺を修正する必要がありそう
  • [ ] Modifier rescue now operates the same for multiple assignment as single assignment. link
    • これは書くことがなさそう
  • [ ] yield in singleton class syntax is warned and will be deprecated later. link
    • 書くことがなさそう
  • [ ] Argument forwarding by (...) is introduced. link
  • [ ] $SAFE の廃止 link
  • [x] Object#{taint,untaint,trust,untrust} のdeprecation link
  • [ ] Object#methodなどでRefinementsを考慮するようになった link
    • 書くことがなさそう

コマンドラインオプション

  • [ ] -wオプションのアップデート link

組み込みクラス

https://github.com/ruby/ruby/blob/e1e1d9227789028891c3553586de1c22e7274fed/NEWS#core-classes-updates-outstanding-ones-only

  • [x] New Array#intersection
  • [x] New Array#minmax
    • 高速化のためだけのメソッドなので、特筆はいらない?
  • [x] Modified Comparable#clamp
    • Rangeを受け取るようになった
  • [x] New Complex#<=>
  • [x] Modified Dir.glob, Dir.[] @pocke
    • null separatedなパターンを受け取らなくなった
  • [ ] New CESU-8 Encoding
  • [x] New Enumerable#filter_map
  • [x] New Enumerable#tally
  • [x] New Enumerator.produce
  • [x] New Enumerator::Lazy#eager
  • [x] New Enumerator::Yielder#to_proc
  • [x] New Fiber#raise
  • [x] Modified File.extname
  • [x] New FrozenError#receiver
  • [x] New GC.compact
  • [x] New IO#set_encoding_by_bom
  • [ ] Modified Integer#[]
    • Rangeを受け取るようになった
  • [ ] Modified Method#inspect
    • 出力結果が変わった
  • [ ] New Module#const_source_location
  • [ ] New Module#ruby2_keywords
  • [ ] Modified Module#autoload?
    • inherit キーワード引数を受け取るようになった
  • [ ] Modified Module#name, NilClass#to_s, TrueClass#to_s, FalseClass#to_s
    • frozen stringを返すようになった
  • [ ] Modified ObjectSpace::WeakMap
  • [ ] New Proc#ruby2_keywords
  • [ ] New Range#minmax
    • 高速化のためだけのメソッドなので、特筆はいらない?
  • [ ] Modified Range#===
    • Stringの場合もRange#cover?を使うようになった
  • [ ] RubyVM.resolve_feature_path moved to $LOAD_PATH.resolve_feature_path.
  • [ ] Unicodeのバージョンが上がった
    • これは書くところあるのかな
  • [ ] New Symbol#start_with?, Symbol#end_with?
  • [ ] New Time#ceil
  • [ ] New Time#floor
  • [ ] Modified Time#inspect
    • 出力が変わった
    • Time#to_sはそのまま
  • [x] New UnboundMethod#bind_call
  • [ ] New Warning.[], Warning.[]=
  • [ ] $LOAD_PATH.resolve_feature_path

標準ライブラリ

https://github.com/ruby/ruby/blob/e1e1d9227789028891c3553586de1c22e7274fed/NEWS#stdlib-updates-outstanding-ones-only

Compatibility issues

https://github.com/ruby/ruby/blob/e1e1d9227789028891c3553586de1c22e7274fed/NEWS#compatibility-issues-excluding-feature-bug-fixes

Stdlib compatibility issues (excluding feature bug fixes)

https://github.com/ruby/ruby/blob/e1e1d9227789028891c3553586de1c22e7274fed/NEWS#stdlib-compatibility-issues-excluding-feature-bug-fixes

C API updates

https://github.com/ruby/ruby/blob/e1e1d9227789028891c3553586de1c22e7274fed/NEWS#c-api-updates

Implementation improvements

https://github.com/ruby/ruby/blob/e1e1d9227789028891c3553586de1c22e7274fed/NEWS#implementation-improvements

Miscellaneous changes

https://github.com/ruby/ruby/blob/e1e1d9227789028891c3553586de1c22e7274fed/NEWS#miscellaneous-changes

その他

  • [ ] refm/doc/news/2_7_0.rd の追加

pocke avatar Dec 24 '19 12:12 pocke

(どこかに書いておかないと忘れそうなのでここに) Time#inspect の出力の変更は https://bugs.ruby-lang.org/issues/16445 のようにTime.at(0.1) だと分数表記になってわかりにくい (= 実際には誤差があることがよくわかる) ので、 Time.at(0.1r) のように Rational のリテラルを使う例にすると良さそうです。

znz avatar Dec 25 '19 00:12 znz

https://techlife.cookpad.com/entry/2019/12/25/121834 これとNEWSを見ながらリストを洗い出していきたい

pocke avatar Dec 25 '19 04:12 pocke

Modified Dir.glob, Dir.[]

これに着手します

pocke avatar Dec 31 '19 09:12 pocke

https://www.ruby-lang.org/ja/news/2019/12/25/ruby-2-7-0-released/ によると

profile.rb は標準添付ライブラリから削除されました。

とのことなので https://docs.ruby-lang.org/ja/latest/library/profile.html も削除すべき?

ktym avatar Jan 09 '20 08:01 ktym

とのことなので https://docs.ruby-lang.org/ja/latest/library/profile.html も削除すべき?

これは"Stdlib compatibility issues (excluding feature bug fixes)"セクションの内容ですね。(力尽きてリストアップはしていません) Ruby 2.7以降は削除すると良さそうです

pocke avatar Jan 09 '20 09:01 pocke

description のチェックリストの以下の項目は既に完了している様に見えますがどうでしょうか〜? 👀

  • New Symbol#start_with?, Symbol#end_with?
    • #2327
  • New Range#minmax
    • #2344
  • refm/doc/news/2_7_0.rd の追加
    • #2248
  • New Warning.[], Warning.[]=
    • #2361

sanfrecce-osaka avatar Oct 20 '20 22:10 sanfrecce-osaka