Skip to content

Commit 5401e3a

Browse files
committed
Ruby 2.7.0-preview1 Released
1 parent 1e53a5f commit 5401e3a

File tree

2 files changed

+198
-0
lines changed

2 files changed

+198
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
layout: news_post
3+
title: "Ruby 2.7.0-preview1 Released"
4+
author: "naruse"
5+
translator:
6+
date: 2019-04-20 00:00:00 +0000
7+
lang: en
8+
---
9+
10+
We are pleased to announce the release of Ruby 2.7.0-preview1.
11+
12+
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:
13+
14+
* Compaction GC
15+
* Pattern Matching
16+
* REPL improvement
17+
18+
## Compaction GC
19+
20+
Compaction GC which can defragment a fragmented memory space is introduced.
21+
22+
Some multithread Ruby program may cause memory fragmentation and it causes high memory usage and degrade speed.
23+
24+
This introduces `GC.compact` method 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)
25+
26+
Known issues: It may cause Segmentation Fault if MJIT is enabled. Please avoid to use both Compaction GC and MJIT at the same time.
27+
28+
## Pattern Matching [Experimental]
29+
30+
Pattern matching, widely used feature in functional programming languages, is introduced as an experimental feature. [#14912](https://bugs.ruby-lang.org/issues/14912)
31+
It can traverse a given object and assign its value if it matches a pattern.
32+
33+
```ruby
34+
case JSON.parse('{...}', symbolize_names: true)
35+
in {name: "Alice", children: [{name: "Bob", age: age}]}
36+
p age
37+
...
38+
end
39+
```
40+
41+
## REPL improvement
42+
43+
`irb`, bundled interactive environment (REPL; Read-Eval-Print-Loop), now supports multi-line editing. It's powered by `reline`, `readline` compatible pure Ruby implementation.
44+
It also provides rdoc integration. In `irb` you can show the reference of given class, module, and 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)
45+
46+
<video autoplay="autoplay" loop="loop" width="478" height="202">
47+
<source src="//ftp.ruby-lang.org/pub/media/irb_multiline.mp4" type="video/mp4">
48+
</video>
49+
50+
## Other Notable New Features
51+
52+
* 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)
53+
54+
* Numbered parameter as the default block parameter is introduced as an experimental feature. [#4475](https://bugs.ruby-lang.org/issues/4475)
55+
56+
* A beginless range is experimentally introduced. It might not be as useful
57+
as an endless range, but would be good for DSL purpose. [14799](https://bugs.ruby-lang.org/issues/14799)
58+
59+
ary[..3] # identical to ary[0..3]
60+
where(sales: ..100)
61+
62+
## Performance improvements
63+
64+
* JIT [Experimental]
65+
66+
* JIT-ed code is recompiled to less-optimized code when an optimization assumption is invalidated.
67+
68+
* 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.
69+
70+
* Default value of +--jit-min-calls+ is changed from 5 to 10,000
71+
72+
* Default value of +--jit-max-cache+ is changed from 1,000 to 100
73+
74+
## Other notable changes since 2.6
75+
76+
* Proc.new and proc with no block in a method called with a block is warned now.
77+
78+
* lambda with no block in a method called with a block errs.
79+
80+
* Update Unicode version and Emoji version from 11.0.0 to 12.0.0. [Feature #15321]
81+
82+
* Update Unicode version to 12.1.0, adding support for U+32FF SQUARE ERA NAME REIWA. [Feature #15195]
83+
84+
* 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]
85+
86+
* Require compilers to support C99 [Misc #15347]
87+
* Details of our dialect: https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/C99
88+
89+
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.
90+
91+
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!
92+
93+
Enjoy programming with Ruby 2.7!
94+
95+
## Download
96+
97+
98+
99+
## What is Ruby
100+
101+
Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993, and now is developing as Open Source. It runs on multiple platforms and used by all over the world especially for Web Development.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
layout: news_post
3+
title: "Ruby 2.7.0-preview1 リリース"
4+
author: "naruse"
5+
translator:
6+
date: 2019-04-20 00:00:00 +0000
7+
lang: ja
8+
---
9+
10+
Ruby 2.7シリーズの最初のプレビュー版である、Ruby 2.7.0-preview1をリリースします。
11+
12+
プレビュー版は、年末の正式リリースに向け、新たな機能を試し、フィードバックを集めるために提供されています。
13+
Ruby 2.7.0-preview1では、多くの新しい機能やパフォーマンスの改善が含まれています。 その一部を以下に紹介します。
14+
15+
## Compaction GC
16+
17+
断片化したメモリをデフラグするCompaction GCが導入されました。
18+
19+
一部のマルチスレッドなRubyプログラムを長期間動かし、マーク&スイープ型GCを何度も実行していると、メモリが断片化してメモリ使用量の増大や性能の劣化を招くことが知られています。
20+
21+
Ruby 2.7では`GC.compact` というメソッドを導入し、ヒープをコンパクションすることが出来るようになります。ヒープ内の生存しているオブジェクトを他のページに移動し、不要なページを解放できるようになるとともに、ヒープをCoW (Copy on Write) フレンドリーにすることが出来ます。 [#15626](https://bugs.ruby-lang.org/issues/15626)
22+
23+
既知の問題: MJITと同時に用いると Segmentation Fault を引き起こすことがあります。MJITとCompation GCを同時に使わないようにして下さい。
24+
25+
## Pattern Matching [Experimental]
26+
27+
関数型言語で広く使われているパターンマッチという機能が実験的に導入されました。
28+
渡されたオブジェクトの構造がパターンと一致するかどうかを調べ、一致した場合にその値を変数に代入するといったことができるようになります。 [#14683](https://bugs.ruby-lang.org/issues/14683) [#14787](https://bugs.ruby-lang.org/issues/14787) [#14918](https://bugs.ruby-lang.org/issues/14918)
29+
30+
```ruby
31+
case JSON.parse('{...}', symbolize_names: true)
32+
in {name: "Alice", children: [{name: "Bob", age: age}]}
33+
p age
34+
...
35+
end
36+
```
37+
38+
## REPL improvement
39+
40+
Ruby に添付されている REPL (Read-Eval-Print-Loop) である `irb` で、複数行編集がサポートされました。これは `reline` という `readline` 互換のピュア Ruby 実装によるものです。
41+
また、rdoc 連携も提供されるようになっています。`irb` 内で、クラス、モジュール、メソッドのリファレンスをその場で確認できるようになりました。 [#14918](https://bugs.ruby-lang.org/issues/14918)
42+
43+
<video autoplay="autoplay" loop="loop" width="478" height="202">
44+
<source src="//ftp.ruby-lang.org/pub/media/irb_multiline.mp4" type="video/mp4">
45+
</video>
46+
47+
## 主要な新機能
48+
49+
* メソッド参照演算子 <code>.:</code> が試験的に導入されました。[#12125]( https://bugs.ruby-lang.org/issues/12125) [#13581]( https://bugs.ruby-lang.org/issues/13581)
50+
51+
* デフォルトのブロックの仮引数として番号指定パラメータが試験的に導入されました。[#4475](https://bugs.ruby-lang.org/issues/4475)
52+
53+
* 開始値省略範囲式が試験的に導入されました。これは終了値省略範囲式ほど有用ではないと思われますが、しかし DSL のような目的には役立つかもしれません。 [#14912](https://bugs.ruby-lang.org/issues/14912)
54+
55+
ary[..3] # identical to ary[0..3]
56+
where(sales: ..100)
57+
58+
59+
## パフォーマンスの改善
60+
61+
* JIT [Experimental]
62+
63+
* 最適化の際の仮定が無効とされた場合、JIT 化されていたコードがより最適化度が低いコードに再コンパイルされるようになりました。
64+
65+
* あるメソッドが「純粋」であると判定された場合、メソッドのインライン化が行われるようになりました。この最適化はまだ実験的であり、また多数のメソッドが今はまだ「純粋」と判定されないままです。
66+
67+
* +--jit-min-calls+ オプションのデフォルト値が 5 から 10,000 に変更されました。
68+
69+
* +--jit-max-cache+ オプションのデフォルト値が 1,000 から 100 に変更されました。
70+
71+
72+
## その他の注目すべき 2.6 からの変更点
73+
74+
* ブロックを渡すメソッド呼び出し中の、ブロックを伴わない Proc.new と proc が警告されるようになりました。
75+
76+
* ブロックを渡すメソッド呼び出し中の、ブロックを伴わない lambda はエラーとなるようになりました。
77+
78+
* Unicode および Emoji のバージョンが 11.0.0 から 12.0.0 になりました。[Feature #15321]
79+
80+
* Unicode のバージョンが 12.1.0 となり、新元号「令和」を表す U+32FF がサポートされました。[Feature #15195]
81+
82+
* Date.jisx0301, Date#jisx0301, および Date.parse で非公式に新元号に仮対応しました。これは JIS X 0301 の新しい版で正式な仕様が決定されるまでの暫定的なものです。[Feature #15742]
83+
84+
* Ruby のビルドに C99 に対応したコンパイラが必要になりました。[Misc #15347]
85+
* 本件についての詳細: https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/C99
86+
87+
なお、こうした変更により、Ruby 2.6.0 以降では [6376 個のファイルに変更が加えられ、227364 行の追加と 51599 行の削除が行われました](https://github.com/ruby/ruby/compare/v2_6_0...v2_7_0) !
88+
89+
Ruby 2.7 でプログラミングをお楽しみください!
90+
91+
## Download
92+
93+
94+
95+
## Ruby とは
96+
97+
Rubyはまつもとゆきひろ (Matz) によって1993年に開発が始められ、今もオープンソースソフトウェアとして開発が続けられています。Rubyは様々なプラットフォームで動き、世界中で、特にWebアプリケーション開発のために使われています。

0 commit comments

Comments
 (0)