-
Notifications
You must be signed in to change notification settings - Fork 629
Ruby 2.7.0-preview1 Released #2045
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5401e3a
Ruby 2.7.0-preview1 Released
nurse 140bd3f
Update en/news/_posts/2019-04-20-ruby-2-7-0-preview1-released.md
nurse 9f2395f
Update en/news/_posts/2019-04-20-ruby-2-7-0-preview1-released.md
nurse e736d21
Update en/news/_posts/2019-04-20-ruby-2-7-0-preview1-released.md
nurse e6e32ce
Update en/news/_posts/2019-04-20-ruby-2-7-0-preview1-released.md
nurse fa90890
Update en/news/_posts/2019-04-20-ruby-2-7-0-preview1-released.md
nurse 6bc626e
Update en/news/_posts/2019-04-20-ruby-2-7-0-preview1-released.md
nurse c7f8d45
Update en/news/_posts/2019-04-20-ruby-2-7-0-preview1-released.md
nurse b2118fb
Update en/news/_posts/2019-04-20-ruby-2-7-0-preview1-released.md
nurse 0827bdf
Update en/news/_posts/2019-04-20-ruby-2-7-0-preview1-released.md
nurse d3a81db
Add file URLs
nurse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
# optional | ||
preview: | ||
|
||
- 2.7.0-preview1 | ||
|
||
stable: | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
en/news/_posts/2019-04-20-ruby-2-7-0-preview1-released.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,130 @@ | ||||||
--- | ||||||
layout: news_post | ||||||
title: "Ruby 2.7.0-preview1 Released" | ||||||
author: "naruse" | ||||||
translator: | ||||||
date: 2019-04-20 00:00:00 +0000 | ||||||
lang: en | ||||||
--- | ||||||
|
||||||
We are pleased to announce the release of Ruby 2.7.0-preview1. | ||||||
|
||||||
A preview version is released to gather feedback for the final release planed to release on December. It introduces a number of new features and performance improvements, most notably: | ||||||
|
||||||
* Compaction GC | ||||||
* Pattern Matching | ||||||
* REPL improvement | ||||||
|
||||||
## Compaction GC | ||||||
|
||||||
This release introduces Compaction GC which can defragment a fragmented memory space. | ||||||
|
||||||
Some multithread Ruby programs may cause memory fragmentation, leading to high memory usage and degraded speed. | ||||||
|
||||||
The `GC.compact` method is introduced for compacting the heap. This function compacts live objects in the heap so that fewer pages may be used, and the heap may be more CoW friendly. [#15626](https://bugs.ruby-lang.org/issues/15626) | ||||||
|
||||||
## Pattern Matching [Experimental] | ||||||
|
||||||
Pattern matching, widely used feature in functional programming languages, is introduced as an experimental feature. [#14912](https://bugs.ruby-lang.org/issues/14912) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
It can traverse a given object and assign its value if it matches a pattern. | ||||||
|
||||||
```ruby | ||||||
case JSON.parse('{...}', symbolize_names: true) | ||||||
in {name: "Alice", children: [{name: "Bob", age: age}]} | ||||||
p age | ||||||
... | ||||||
end | ||||||
``` | ||||||
|
||||||
For more details, please see https://speakerdeck.com/k_tsj/pattern-matching-new-feature-in-ruby-2-dot-7. | ||||||
|
||||||
## REPL improvement | ||||||
|
||||||
`irb`, bundled interactive environment (REPL; Read-Eval-Print-Loop), now supports multi-line editing. It's powered by `reline`, `readline` compatible pure Ruby implementation. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
It also provides rdoc integration. In `irb` you can display the reference for a given class, module, or method. [#14683](https://bugs.ruby-lang.org/issues/14683), [#14787](https://bugs.ruby-lang.org/issues/14787), [#14918](https://bugs.ruby-lang.org/issues/14918) | ||||||
Besides, source lines shown at `binding.irb` and inspect results for core-class objects are now colorized. | ||||||
|
||||||
<video autoplay="autoplay" loop="loop" width="478" height="202"> | ||||||
<source src="https://cache.ruby-lang.org/pub/media/irb_improved_with_key_take2.mp4" type="video/mp4"> | ||||||
</video> | ||||||
|
||||||
## Other Notable New Features | ||||||
|
||||||
* A method reference operator, <code>.:</code>, is introduced as an experimental feature. [#12125]( https://bugs.ruby-lang.org/issues/12125), [#13581]( https://bugs.ruby-lang.org/issues/13581) | ||||||
|
||||||
* Numbered parameter as the default block parameter is introduced as an experimental feature. [#4475](https://bugs.ruby-lang.org/issues/4475) | ||||||
|
||||||
* A beginless range is experimentally introduced. It might not be as useful | ||||||
as an endless range, but would be good for DSL purpose. [#14799](https://bugs.ruby-lang.org/issues/14799) | ||||||
|
||||||
ary[..3] # identical to ary[0..3] | ||||||
rel.where(sales: ..100) | ||||||
|
||||||
* `Enumerable#tally` is added. It counts the occurrence of each element. | ||||||
|
||||||
["a", "b", "c", "b"].tally | ||||||
#=> {"a"=>1, "b"=>2, "c"=>1} | ||||||
|
||||||
## Performance improvements | ||||||
|
||||||
* JIT [Experimental] | ||||||
|
||||||
* JIT-ed code is recompiled to less-optimized code when an optimization assumption is invalidated. | ||||||
|
||||||
* Method inlining is performed when a method is considered as pure. This optimization is still experimental and many methods are NOT considered as pure yet. | ||||||
|
||||||
* Default value of `--jit-min-calls` is changed from 5 to 10,000 | ||||||
|
||||||
* Default value of `--jit-max-cache` is changed from 1,000 to 100 | ||||||
|
||||||
## Other notable changes since 2.6 | ||||||
|
||||||
* `Proc.new` and `proc` with no block in a method called with a block is warned now. | ||||||
|
||||||
* `lambda` with no block in a method called with a block errs. | ||||||
|
||||||
* Update Unicode version and Emoji version from 11.0.0 to 12.0.0. [[Feature #15321]](https://bugs.ruby-lang.org/issues/15321) | ||||||
|
||||||
* Update Unicode version to 12.1.0, adding support for U+32FF SQUARE ERA NAME REIWA. [[Feature #15195]](https://bugs.ruby-lang.org/issues/15195) | ||||||
|
||||||
* `Date.jisx0301`, `Date#jisx0301`, and `Date.parse` provisionally support the new Japanese era as an informal extension, until the new JIS X 0301 is issued. [[Feature #15742]](https://bugs.ruby-lang.org/issues/15742) | ||||||
|
||||||
* Require compilers to support C99 [[Misc #15347]](https://bugs.ruby-lang.org/issues/15347) | ||||||
* Details of our dialect: <https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/C99> | ||||||
|
||||||
See [NEWS](https://github.com/ruby/ruby/blob/v2_7_0_preview1/NEWS) or [commit logs](https://github.com/ruby/ruby/compare/v2_6_0...v2_7_0_preview1) for more details. | ||||||
|
||||||
With those changes, [6376 files changed, 227364 insertions(+), 51599 deletions(-)](https://github.com/ruby/ruby/compare/v2_6_0...v2_7_0_preview1) since Ruby 2.6.0! | ||||||
|
||||||
Enjoy programming with Ruby 2.7! | ||||||
|
||||||
## Download | ||||||
|
||||||
* <https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0-preview1.tar.gz> | ||||||
|
||||||
SIZE: 16020966 bytes | ||||||
SHA1: f968d0c6117a7767af0b354458195de1df628b93 | ||||||
SHA256: b61dba9ed01e855000111964363fbd691219ab3c567455434717ecba962747ea | ||||||
SHA512: 820ac03c08fd6e8283275a0d37caac9787afb85426bbb27e2105d8007bbc7ad6a35b2b40c8af81cdbb7a00347d44e92b5ff9b6e7f48f22d05584cedb85578409 | ||||||
* <https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0-preview1.zip> | ||||||
|
||||||
SIZE: 20283209 bytes | ||||||
SHA1: fc31cb0620962f0aa73c902edfc8523ec5b2a2ec | ||||||
SHA256: 59da2314822add396f68ce3e8e43e98843d41f4eab2354edc7f793a1ec3f3359 | ||||||
SHA512: e6726f21dc5e90f42e762a81cbf88caef325fe2d589d75a81d82663652695ed94b3be6e12fe238fc82e5caebb16e626456d9e9dfa4ecc6a55e532ba372b2d4de | ||||||
* <https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0-preview1.tar.bz2> | ||||||
|
||||||
SIZE: 14040553 bytes | ||||||
SHA1: 0a03aa856d87110e14a621d5bf7378de59a9d682 | ||||||
SHA256: b20c80adc1324c0ec87bf3f4a66b837771d7a30fc876d83e68e519c623cf0369 | ||||||
SHA512: 282d51ab6a76f40014e7c1738a1a02484e12bd52057db953e356b300974f5a1603a14dc23e436587870767213816c5adda335e6f8716de02c8fd853c85447250 | ||||||
* <https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0-preview1.tar.xz> | ||||||
|
||||||
SIZE: 11440260 bytes | ||||||
SHA1: c7297e4a9e81657a9c8731da8de2e2aa4d4879c3 | ||||||
SHA256: 540f11753f5805c1bf560c54a44d1ea04414217c7d319cac165de964e269399f | ||||||
SHA512: 78afd2b167658d0edb368a3f5f91446a5f6f63b451bfc1966af8964579bc74f6c6a2d227c8715ab742e97c6895ce4006b56ba0eed97b6effcd93555b43d90313 | ||||||
|
||||||
## What is Ruby | ||||||
|
||||||
Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993, and is now developed as Open Source. It runs on multiple platforms and is used all over the world especially for web development. |
125 changes: 125 additions & 0 deletions
125
ja/news/_posts/2019-04-20-ruby-2-7-0-preview1-released.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
--- | ||
layout: news_post | ||
title: "Ruby 2.7.0-preview1 リリース" | ||
author: "naruse" | ||
translator: | ||
date: 2019-04-20 00:00:00 +0000 | ||
lang: ja | ||
--- | ||
|
||
Ruby 2.7シリーズの最初のプレビュー版である、Ruby 2.7.0-preview1をリリースします。 | ||
|
||
プレビュー版は、年末の正式リリースに向け、新たな機能を試し、フィードバックを集めるために提供されています。 | ||
Ruby 2.7.0-preview1では、多くの新しい機能やパフォーマンスの改善が含まれています。 その一部を以下に紹介します。 | ||
|
||
## Compaction GC | ||
|
||
断片化したメモリをデフラグするCompaction GCが導入されました。 | ||
|
||
一部のマルチスレッドなRubyプログラムを長期間動かし、マーク&スイープ型GCを何度も実行していると、メモリが断片化してメモリ使用量の増大や性能の劣化を招くことが知られています。 | ||
|
||
Ruby 2.7では`GC.compact` というメソッドを導入し、ヒープをコンパクションすることが出来るようになります。ヒープ内の生存しているオブジェクトを他のページに移動し、不要なページを解放できるようになるとともに、ヒープをCoW (Copy on Write) フレンドリーにすることが出来ます。 [#15626](https://bugs.ruby-lang.org/issues/15626) | ||
|
||
## Pattern Matching [Experimental] | ||
|
||
関数型言語で広く使われているパターンマッチという機能が実験的に導入されました。 | ||
渡されたオブジェクトの構造がパターンと一致するかどうかを調べ、一致した場合にその値を変数に代入するといったことができるようになります。 [#14912](https://bugs.ruby-lang.org/issues/14912) | ||
|
||
```ruby | ||
case JSON.parse('{...}', symbolize_names: true) | ||
in {name: "Alice", children: [{name: "Bob", age: age}]} | ||
p age | ||
... | ||
end | ||
``` | ||
|
||
詳細については https://speakerdeck.com/k_tsj/pattern-matching-new-feature-in-ruby-2-dot-7 を参照してください。 | ||
|
||
## REPL improvement | ||
|
||
Ruby に添付されている REPL (Read-Eval-Print-Loop) である `irb` で、複数行編集がサポートされました。これは `reline` という `readline` 互換のピュア Ruby 実装によるものです。 | ||
また、rdoc 連携も提供されるようになっています。`irb` 内で、クラス、モジュール、メソッドのリファレンスをその場で確認できるようになりました。 [#14683](https://bugs.ruby-lang.org/issues/14683), [#14787](https://bugs.ruby-lang.org/issues/14787), [#14918](https://bugs.ruby-lang.org/issues/14918) | ||
これに加え、`binding.irb`で表示される周辺のコードや、コアクラスのオブジェクトのinspect結果に色がつくようになっています。 | ||
|
||
<video autoplay="autoplay" loop="loop" width="478" height="202"> | ||
<source src="https://cache.ruby-lang.org/pub/media/irb_improved_with_key_take2.mp4" type="video/mp4"> | ||
</video> | ||
|
||
## 主要な新機能 | ||
|
||
* メソッド参照演算子 <code>.:</code> が試験的に導入されました。[#12125](https://bugs.ruby-lang.org/issues/12125), [#13581](https://bugs.ruby-lang.org/issues/13581) | ||
|
||
* デフォルトのブロックの仮引数として番号指定パラメータが試験的に導入されました。[#4475](https://bugs.ruby-lang.org/issues/4475) | ||
|
||
* 開始値省略範囲式が試験的に導入されました。これは終了値省略範囲式ほど有用ではないと思われますが、しかし DSL のような目的には役立つかもしれません。 [#14799](https://bugs.ruby-lang.org/issues/14799) | ||
|
||
ary[..3] # identical to ary[0..3] | ||
rel.where(sales: ..100) | ||
|
||
* `Enumerable#tally` が追加されました。各要素の出現回数を数えます。 | ||
|
||
["a", "b", "c", "b"].tally | ||
#=> {"a"=>1, "b"=>2, "c"=>1} | ||
|
||
## パフォーマンスの改善 | ||
|
||
* JIT [Experimental] | ||
|
||
* 最適化の際の仮定が無効とされた場合、JIT 化されていたコードがより最適化度が低いコードに再コンパイルされるようになりました。 | ||
|
||
* あるメソッドが「純粋」であると判定された場合、メソッドのインライン化が行われるようになりました。この最適化はまだ実験的であり、また多数のメソッドが今はまだ「純粋」と判定されないままです。 | ||
|
||
* `--jit-min-calls` オプションのデフォルト値が 5 から 10,000 に変更されました。 | ||
|
||
* `--jit-max-cache` オプションのデフォルト値が 1,000 から 100 に変更されました。 | ||
|
||
|
||
## その他の注目すべき 2.6 からの変更点 | ||
|
||
* ブロックを渡すメソッド呼び出し中の、ブロックを伴わない `Proc.new` と `proc` が警告されるようになりました。 | ||
|
||
* ブロックを渡すメソッド呼び出し中の、ブロックを伴わない `lambda` はエラーとなるようになりました。 | ||
|
||
* Unicode および Emoji のバージョンが 11.0.0 から 12.0.0 になりました。[[Feature #15321]](https://bugs.ruby-lang.org/issues/15321) | ||
|
||
* Unicode のバージョンが 12.1.0 となり、新元号「令和」を表す合字 U+32FF がサポートされました。[[Feature #15195]](https://bugs.ruby-lang.org/issues/15195) | ||
|
||
* `Date.jisx0301`, `Date#jisx0301`, および `Date.parse` で非公式に新元号に仮対応しました。これは JIS X 0301 の新しい版で正式な仕様が決定されるまでの暫定的なものです。[[Feature #15742]](https://bugs.ruby-lang.org/issues/15742) | ||
|
||
* Ruby のビルドに C99 に対応したコンパイラが必要になりました。[[Misc #15347]](https://bugs.ruby-lang.org/issues/15347) | ||
* 本件についての詳細: <https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/C99> | ||
|
||
なお、こうした変更により、Ruby 2.6.0 以降では [6376 個のファイルに変更が加えられ、227364 行の追加と 51599 行の削除が行われました](https://github.com/ruby/ruby/compare/v2_6_0...v2_7_0_preview1) ! | ||
|
||
Ruby 2.7 でプログラミングをお楽しみください! | ||
|
||
## Download | ||
|
||
* <https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0-preview1.tar.gz> | ||
|
||
SIZE: 16020966 bytes | ||
SHA1: f968d0c6117a7767af0b354458195de1df628b93 | ||
SHA256: b61dba9ed01e855000111964363fbd691219ab3c567455434717ecba962747ea | ||
SHA512: 820ac03c08fd6e8283275a0d37caac9787afb85426bbb27e2105d8007bbc7ad6a35b2b40c8af81cdbb7a00347d44e92b5ff9b6e7f48f22d05584cedb85578409 | ||
* <https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0-preview1.zip> | ||
|
||
SIZE: 20283209 bytes | ||
SHA1: fc31cb0620962f0aa73c902edfc8523ec5b2a2ec | ||
SHA256: 59da2314822add396f68ce3e8e43e98843d41f4eab2354edc7f793a1ec3f3359 | ||
SHA512: e6726f21dc5e90f42e762a81cbf88caef325fe2d589d75a81d82663652695ed94b3be6e12fe238fc82e5caebb16e626456d9e9dfa4ecc6a55e532ba372b2d4de | ||
* <https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0-preview1.tar.bz2> | ||
|
||
SIZE: 14040553 bytes | ||
SHA1: 0a03aa856d87110e14a621d5bf7378de59a9d682 | ||
SHA256: b20c80adc1324c0ec87bf3f4a66b837771d7a30fc876d83e68e519c623cf0369 | ||
SHA512: 282d51ab6a76f40014e7c1738a1a02484e12bd52057db953e356b300974f5a1603a14dc23e436587870767213816c5adda335e6f8716de02c8fd853c85447250 | ||
* <https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0-preview1.tar.xz> | ||
|
||
SIZE: 11440260 bytes | ||
SHA1: c7297e4a9e81657a9c8731da8de2e2aa4d4879c3 | ||
SHA256: 540f11753f5805c1bf560c54a44d1ea04414217c7d319cac165de964e269399f | ||
SHA512: 78afd2b167658d0edb368a3f5f91446a5f6f63b451bfc1966af8964579bc74f6c6a2d227c8715ab742e97c6895ce4006b56ba0eed97b6effcd93555b43d90313 | ||
|
||
## Ruby とは | ||
|
||
Rubyはまつもとゆきひろ (Matz) によって1993年に開発が始められ、今もオープンソースソフトウェアとして開発が続けられています。Rubyは様々なプラットフォームで動き、世界中で、特にWebアプリケーション開発のために使われています。 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.