Skip to content

Commit c10ca87

Browse files
authored
Ruby 3.2.0 Preview 1 Released (#2813)
1 parent bc6f184 commit c10ca87

File tree

5 files changed

+355
-0
lines changed

5 files changed

+355
-0
lines changed

_data/branches.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
# date: date of first stable release (YYYY-MM-DD)
99
# eol_date: date of EOL (YYYY-MM-DD)
1010

11+
- name: 3.2
12+
status: preview
13+
date:
14+
eol_date:
15+
1116
- name: 3.1
1217
status: normal maintenance
1318
date: 2021-12-25

_data/downloads.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# optional
55
preview:
66

7+
- 3.2.0-preview1
78

89
stable:
910

_data/releases.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,37 @@
1919
# In order to get the release listed on the downloads page,
2020
# you also need to add an entry to `_data/downloads.yml'.
2121

22+
# 3.2 series
23+
24+
- version: 3.2.0-preview1
25+
date: 2022-04-03
26+
post: /en/news/2022/04/03/ruby-3-2-0-preview1-released/
27+
tag: v3_2_0_preview1
28+
stats:
29+
files_changed: 1058
30+
insertions: 34946
31+
deletions: 29962
32+
url:
33+
gz: https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0-preview1.tar.gz
34+
zip: https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0-preview1.zip
35+
xz: https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0-preview1.tar.xz
36+
size:
37+
gz: 20728782
38+
zip: 25370458
39+
xz: 15011400
40+
sha1:
41+
gz: 7c4197e67f230b0c5d011f4efb9b9158743a61c8
42+
zip: 3c93c2e775366eec6e93cf670fc8677934cb4e48
43+
xz: 6bcc30ac670ab391997e0d68ba97b451db078934
44+
sha256:
45+
gz: 6946b966c561d5dfc2a662b88e8211be30bfffc7bb2f37ce3cc62d6c46a0b818
46+
zip: 24f8ae73d56366453defb0654de624bd1c063921a1d7ac780e4da56bb8fbf7e4
47+
xz: 6d28477f7fa626b63bf139afd37bcfeb28fce6847b203fa10f37cb3615d0c35d
48+
sha512:
49+
gz: d24e77161996c2085f613a86d1ed5ef5c5bf0e18eb459f6a93a0014a5d2ce41079283b4283d24cb96448a0986c8c6c52a04584abd4e73911ea59cefeb786836e
50+
zip: 9754f11aa167df167d1b336e5c660aab1bd9e12421c093e0fe96e9a2da4ffb9859b7ea5263473bbc7b57ac8b5568cf7ac3116c0abdc647e1ff97a8d060ff7eae
51+
xz: 0eca2c346b995d265df2659b4215ff96e515c29926c2a6256caad99db9c4c51fec1a2d899ca63a00010d4111060dc0fdd4f591be84c0a2c43b6303879de3c5de
52+
2253
# 3.1 series
2354

2455
- version: 3.1.1
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
---
2+
layout: news_post
3+
title: "Ruby 3.2.0 Preview 1 Released"
4+
author: "naruse"
5+
translator:
6+
date: 2022-04-03 00:00:00 +0000
7+
lang: en
8+
---
9+
10+
{% assign release = site.data.releases | where: "version", "3.2.0-preview1" | first %}
11+
12+
We are pleased to announce the release of Ruby {{ release.version }}. Ruby 3.2 adds many features and performance improvements.
13+
14+
15+
## WASI based WebAssembly support
16+
17+
This is an initial port of WASI based WebAssembly support. This enables a CRuby binary to be available on Web browser, Serverless Edge environment, and other WebAssembly/WASI embedders. Currently this port passes basic and bootstrap test suites not using Thread API.
18+
19+
![](https://i.imgur.com/opCgKy2.png)
20+
21+
### Background
22+
23+
[WebAssembly (WASM)](https://webassembly.org/) is originally introduced to run programs safely and fast in web browsers. But its objective - running programs efficinently with security on various environment - is long wanted not only by web but also by general applications.
24+
25+
[WASI (The WebAssembly System Interface)](https://wasi.dev/) is designed for such use cases. Though such applications need to communicate with operating systems, WebAssembly runs on a virtual machine which didn't have a system interface. WASI standardizes it.
26+
27+
WebAssembly/WASI Support in Ruby intends to leverage those projects. It enables Ruby developers to write applications which runs on such promised platform.
28+
29+
### Use case
30+
31+
This support encourages developers can utilize CRuby in WebAssembly environment. An example use case of it is [TryRuby playground](https://try.ruby-lang.org/playground/)'s CRuby support. Now you can try original CRuby in your web browser.
32+
33+
### Technical points
34+
35+
Today’s WASI and WebAssembly itself has some missing features to implement Fiber, exception, and GC because it’s still evolving and also for security reasons. So CRuby fills the gap by using Asyncify, which is a binary transformation technique to control execution in userland.
36+
37+
In addition, we built [a VFS on top of WASI](https://github.com/kateinoigakukun/wasi-vfs/wiki/Getting-Started-with-CRuby) so that we can easily pack Ruby apps into a single .wasm file. This makes distribution of Ruby apps a bit easier.
38+
39+
40+
### Related links
41+
42+
* [Add WASI based WebAssembly support #5407](https://github.com/ruby/ruby/pull/5407)
43+
* [An Update on WebAssembly/WASI Support in Ruby](https://itnext.io/final-report-webassembly-wasi-support-in-ruby-4aface7d90c9)
44+
45+
## Regexp timeout
46+
47+
A timeout feature for Regexp matching is introduced.
48+
49+
```ruby
50+
Regexp.timeout = 1.0
51+
52+
/^a*b?a*$/ =~ "a" * 50000 + "x"
53+
#=> Regexp::TimeoutError is raised in one second
54+
```
55+
56+
It is known that Regexp matching may take unexpectedly long. If your code attempts to match an possibly inefficient Regexp against an untrusted input, an attacker may exploit it for efficient Denial of Service (so-called Regular expression DoS, or ReDoS).
57+
58+
The risk of DoS can be prevented or significantly mitigated by configuring `Regexp.timeout` according to the requirements of your Ruby application. Please try it out in your application and welcome your feedback.
59+
60+
Note that `Regexp.timeout` is a global configuration. If you want to use different timeout settings for some special Regexps, you may want to use `timeout` keyword for `Regexp.new`.
61+
62+
```ruby
63+
Regexp.timeout = 1.0
64+
65+
# This regexp has no timeout
66+
long_time_re = Regexp.new("^a*b?a*$", timeout: nil)
67+
68+
long_time_re =~ "a" * 50000 + "x" # never interrupted
69+
```
70+
71+
The original proposal is https://bugs.ruby-lang.org/issues/17837
72+
73+
74+
## Other Notable New Features
75+
76+
### No longer bundle 3rd party sources
77+
78+
* We no longer bundle 3rd party sources like `libyaml`, `libffi`.
79+
80+
* libyaml source has been removed from psych. You may need to install `libyaml-dev` with Ubuntu/Debian platfrom. The package name is different each platforms.
81+
82+
* libffi will be removed from `fiddle` at preview2
83+
84+
### Language
85+
86+
* Find pattern is no longer experimental.
87+
88+
89+
## Performance improvements
90+
91+
92+
93+
## Other notable changes since 3.1
94+
95+
* Hash
96+
* Hash#shift now always returns nil if the hash is
97+
empty, instead of returning the default value or
98+
calling the default proc. [[Bug #16908]]
99+
100+
* MatchData
101+
* MatchData#byteoffset has been added. [[Feature #13110]]
102+
103+
* Module
104+
* Module.used_refinements has been added. [[Feature #14332]]
105+
* Module#refinements has been added. [[Feature #12737]]
106+
* Module#const_added has been added. [[Feature #17881]]
107+
108+
* Proc
109+
* Proc#dup returns an instance of subclass. [[Bug #17545]]
110+
* Proc#parameters now accepts lambda keyword. [[Feature #15357]]
111+
112+
* Refinement
113+
* Refinement#refined_class has been added. [[Feature #12737]]
114+
115+
* Set
116+
* Set is now available as a builtin class without the need for `require "set"`. [[Feature #16989]]
117+
It is currently autoloaded via the `Set` constant or a call to `Enumerable#to_set`.
118+
119+
* String
120+
* String#byteindex and String#byterindex have been added. [[Feature #13110]]
121+
* Update Unicode to Version 14.0.0 and Emoji Version 14.0. [[Feature #18037]]
122+
(also applies to Regexp)
123+
* String#bytesplice has been added. [[Feature #18598]]
124+
125+
* Struct
126+
* A Struct class can also be initialized with keyword arguments
127+
without `keyword_init: true` on `Struct.new` [[Feature #16806]]
128+
129+
130+
### Standard libraries updates
131+
132+
* The following default gem are updated.
133+
134+
* TBD
135+
136+
* The following bundled gems are updated.
137+
138+
* TBD
139+
140+
* The following default gems are now bundled gems. You need to add the following libraries to `Gemfile` under the bundler environment.
141+
142+
* TBD
143+
144+
See [NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md)
145+
or [commit logs](https://github.com/ruby/ruby/compare/v3_1_0...{{ release.tag }})
146+
for more details.
147+
148+
With those changes, [{{ release.stats.files_changed }} files changed, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} deletions(-)](https://github.com/ruby/ruby/compare/v3_1_0...{{ release.tag }}#file_bucket)
149+
since Ruby 3.1.0!
150+
151+
## Download
152+
153+
* <{{ release.url.gz }}>
154+
155+
SIZE: {{ release.size.gz }}
156+
SHA1: {{ release.sha1.gz }}
157+
SHA256: {{ release.sha256.gz }}
158+
SHA512: {{ release.sha512.gz }}
159+
160+
* <{{ release.url.xz }}>
161+
162+
SIZE: {{ release.size.xz }}
163+
SHA1: {{ release.sha1.xz }}
164+
SHA256: {{ release.sha256.xz }}
165+
SHA512: {{ release.sha512.xz }}
166+
167+
* <{{ release.url.zip }}>
168+
169+
SIZE: {{ release.size.zip }}
170+
SHA1: {{ release.sha1.zip }}
171+
SHA256: {{ release.sha256.zip }}
172+
SHA512: {{ release.sha512.zip }}
173+
174+
## What is Ruby
175+
176+
Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993,
177+
and is now developed as Open Source. It runs on multiple platforms
178+
and is used all over the world especially for web development.
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
---
2+
layout: news_post
3+
title: "Ruby 3.2.0 Preview 1 リリース"
4+
author: "naruse"
5+
translator:
6+
date: 2022-04-03 00:00:00 +0000
7+
lang: ja
8+
---
9+
10+
Ruby 3.2系最初のプレビューリリースである、Ruby 3.2.0 Preview 1 が公開されました。Ruby 3.2では多くの機能を追加しています。
11+
12+
{% assign release = site.data.releases | where: "version", "3.2.0-preview1" | first %}
13+
14+
15+
## WASIベースのWebAssemblyサポート
16+
17+
WASIベースのWebAssemblyへのコンパイルがサポートされました。これにより、ブラウザやサーバーレスエッジ環境、その他のWebAssembly/WASI環境でCRubyのバイナリが利用できるようになります。現在この移植版はThread API以外のbasic testとbootstrap testをパスしています。
18+
19+
![](https://i.imgur.com/opCgKy2.png)
20+
21+
### Background
22+
23+
もともと[WebAssembly (WASM)](https://webassembly.org/)が導入されたのは、プログラムをブラウザの上で安全かつ高速に実行するためでした。しかし、様々な環境で安全かつ効率的にプログラムを実行するという目的は、Webだけでなく一般的なアプリケーションで長らく求められていたものです
24+
25+
[WASI (The WebAssembly System Interface)](https://wasi.dev/)はそのようなユースケースのために設計されました。そのようなアプリケーションはOSと通信する必要がありますが、WebAssembly自体はシステムインターフェイスを持たないVMの上で実行されます。WASIはこのシステムインターフェイスを規格化します。
26+
27+
RubyのWebAssembly/WASIサポートは、このようなプロジェクトを活用することを狙っています。これにより、Ruby開発者がそのような有望なプラットフォームで動くアプリケーションを書けるようになります。
28+
29+
### ユースケース
30+
31+
このサポートは、開発者がCRubyをWebAssembly環境で利用することを促進します。たとえば、[TryRuby playground](https://try.ruby-lang.org/playground/)のCRubyサポートです。CRubyをウェブブラウザの上で試すことができるようになりました。
32+
33+
### 技術的な話
34+
35+
現時点のWASIとWebAssemblyには、Fiberや例外やGCを実装するための機能に一部足りないものがあります。CRubyではこのギャップを埋めるために、ユーザランドで実行を制御できるAsyncifyというバイナリ変換技術を使っています。
36+
37+
さらに、[WASIの上にVFS](https://github.com/kateinoigakukun/wasi-vfs/wiki/Getting-Started-with-CRuby)を実装しました。これにより、Rubyアプリを単一の.wasmファイルに容易にパッケージ化できます。Rubyアプリの配布が少しかんたんになります。
38+
39+
### 参考文献
40+
41+
* [Add WASI based WebAssembly support #5407](https://github.com/ruby/ruby/pull/5407)
42+
* [An Update on WebAssembly/WASI Support in Ruby](https://itnext.io/final-report-webassembly-wasi-support-in-ruby-4aface7d90c9)
43+
44+
## Regexp timeout
45+
46+
正規表現マッチングにタイムアウトを指定できるようになりました。
47+
48+
```ruby
49+
Regexp.timeout = 1.0
50+
51+
/^a*b?a*$/ =~ "a" * 50000 + "x" #=> 1秒後にRegexp::TimeoutError
52+
```
53+
54+
正規表現マッチングは予想外に時間がかかることがあることが知られています。もし信頼できない入力に対して非効率な可能性のある正規表現をマッチしていると、Denial of Service攻撃を効率的にできてしまう可能性があります(正規表現DoS、ReDoSなどと言われます)。
55+
56+
あなたのRubyアプリケーションの要件に基づいて適切に`Regexp.timeout`を設定することで、DoSのリスクを防止、または大幅に緩和できます。ぜひあなたのアプリケーションで試してみてください。フィードバックを歓迎します。
57+
58+
なお、Regexp.timeoutはグローバルな設定です。もし一部の特別な正規表現にだけ異なるタイムアウトを設定したい場合は、`Regexp.new``timeout`キーワードを指定してください。
59+
60+
```ruby
61+
Regexp.timeout = 1.0
62+
63+
long_time_re = Regexp.new("^a*b?a*$", timeout: nil) # タイムアウトなし
64+
65+
long_time_re =~ "a" * 50000 + "x" # 割り込まれない
66+
```
67+
68+
機能提案のチケット:https://bugs.ruby-lang.org/issues/17837
69+
70+
71+
## その他の主要な新機能
72+
73+
### 言語機能
74+
75+
* Find patternが実験的機能ではなくなりました。
76+
77+
78+
### 非互換な変更
79+
80+
* `libyaml``libffi` のような 3rd パーティのライブラリのソースコードの同梱を廃止しました
81+
82+
* Psych に同梱していた `libyaml` のソースコードは削除されました。ユーザーは自身で Ubuntu や Debian プラットフォームなら `libyaml-dev` パッケージをインストールする必要があります。このパッケージ名称はプラットフォームごとに異なります。
83+
84+
* Fiddle に同梱していた `libffi` のソースコードは preview2 で削除する予定です。
85+
86+
87+
## パフォーマンスの改善
88+
89+
90+
91+
92+
## その他の注目すべき 3.1 からの変更点
93+
94+
95+
96+
97+
## 標準添付ライブラリのアップデート
98+
99+
* 以下の default gems のバージョンがアップデートされました。
100+
101+
* TBD
102+
103+
* 以下の bundled gems のバージョンがアップデートされました。
104+
105+
* TBD
106+
107+
* 以下のライブラリが新たに bundled gems になりました。Bundler から利用する場合は Gemfile に明示的に指定してください。
108+
109+
* TBD
110+
111+
その他詳細については、[NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md) ファイルまたは[コミットログ](https://github.com/ruby/ruby/compare/v3_1_0...{{ release.tag }})を参照してください。
112+
113+
なお、こうした変更により、Ruby 3.1.0 以降では [{{ release.stats.files_changed }} 個のファイルに変更が加えられ、{{ release.stats.insertions }} 行の追加と {{ release.stats.deletions }} 行の削除が行われました](https://github.com/ruby/ruby/compare/v3_1_0...{{ release.tag }}#file_bucket) !
114+
115+
## ダウンロード
116+
117+
* <{{ release.url.gz }}>
118+
119+
SIZE: {{ release.size.gz }}
120+
SHA1: {{ release.sha1.gz }}
121+
SHA256: {{ release.sha256.gz }}
122+
SHA512: {{ release.sha512.gz }}
123+
124+
* <{{ release.url.xz }}>
125+
126+
SIZE: {{ release.size.xz }}
127+
SHA1: {{ release.sha1.xz }}
128+
SHA256: {{ release.sha256.xz }}
129+
SHA512: {{ release.sha512.xz }}
130+
131+
* <{{ release.url.zip }}>
132+
133+
SIZE: {{ release.size.zip }}
134+
SHA1: {{ release.sha1.zip }}
135+
SHA256: {{ release.sha256.zip }}
136+
SHA512: {{ release.sha512.zip }}
137+
138+
## Ruby とは
139+
140+
Rubyはまつもとゆきひろ (Matz) によって1993年に開発が始められ、今もオープンソースソフトウェアとして開発が続けられています。Rubyは様々なプラットフォームで動き、世界中で、特にWebアプリケーション開発のために使われています。

0 commit comments

Comments
 (0)