diff --git a/_data/branches.yml b/_data/branches.yml index a4054fb534..6e63437c17 100644 --- a/_data/branches.yml +++ b/_data/branches.yml @@ -8,6 +8,11 @@ # date: date of first stable release (YYYY-MM-DD) # eol_date: date of EOL (YYYY-MM-DD) +- name: 3.2 + status: preview + date: + eol_date: + - name: 3.1 status: normal maintenance date: 2021-12-25 diff --git a/_data/downloads.yml b/_data/downloads.yml index 504498f517..9a1bda211a 100644 --- a/_data/downloads.yml +++ b/_data/downloads.yml @@ -4,6 +4,7 @@ # optional preview: + - 3.2.0-preview1 stable: diff --git a/_data/releases.yml b/_data/releases.yml index 104a3fcb73..b58ca7d8e4 100644 --- a/_data/releases.yml +++ b/_data/releases.yml @@ -19,6 +19,37 @@ # In order to get the release listed on the downloads page, # you also need to add an entry to `_data/downloads.yml'. +# 3.2 series + +- version: 3.2.0-preview1 + date: 2022-04-03 + post: /en/news/2022/04/03/ruby-3-2-0-preview1-released/ + tag: v3_2_0_preview1 + stats: + files_changed: 1058 + insertions: 34946 + deletions: 29962 + url: + gz: https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0-preview1.tar.gz + zip: https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0-preview1.zip + xz: https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0-preview1.tar.xz + size: + gz: 20728782 + zip: 25370458 + xz: 15011400 + sha1: + gz: 7c4197e67f230b0c5d011f4efb9b9158743a61c8 + zip: 3c93c2e775366eec6e93cf670fc8677934cb4e48 + xz: 6bcc30ac670ab391997e0d68ba97b451db078934 + sha256: + gz: 6946b966c561d5dfc2a662b88e8211be30bfffc7bb2f37ce3cc62d6c46a0b818 + zip: 24f8ae73d56366453defb0654de624bd1c063921a1d7ac780e4da56bb8fbf7e4 + xz: 6d28477f7fa626b63bf139afd37bcfeb28fce6847b203fa10f37cb3615d0c35d + sha512: + gz: d24e77161996c2085f613a86d1ed5ef5c5bf0e18eb459f6a93a0014a5d2ce41079283b4283d24cb96448a0986c8c6c52a04584abd4e73911ea59cefeb786836e + zip: 9754f11aa167df167d1b336e5c660aab1bd9e12421c093e0fe96e9a2da4ffb9859b7ea5263473bbc7b57ac8b5568cf7ac3116c0abdc647e1ff97a8d060ff7eae + xz: 0eca2c346b995d265df2659b4215ff96e515c29926c2a6256caad99db9c4c51fec1a2d899ca63a00010d4111060dc0fdd4f591be84c0a2c43b6303879de3c5de + # 3.1 series - version: 3.1.1 diff --git a/en/news/_posts/2022-04-03-ruby-3-2-0-preview1-released.md b/en/news/_posts/2022-04-03-ruby-3-2-0-preview1-released.md new file mode 100644 index 0000000000..e3c11f0a66 --- /dev/null +++ b/en/news/_posts/2022-04-03-ruby-3-2-0-preview1-released.md @@ -0,0 +1,178 @@ +--- +layout: news_post +title: "Ruby 3.2.0 Preview 1 Released" +author: "naruse" +translator: +date: 2022-04-03 00:00:00 +0000 +lang: en +--- + +{% assign release = site.data.releases | where: "version", "3.2.0-preview1" | first %} + +We are pleased to announce the release of Ruby {{ release.version }}. Ruby 3.2 adds many features and performance improvements. + + +## WASI based WebAssembly support + +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. + +![](https://i.imgur.com/opCgKy2.png) + +### Background + +[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. + +[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. + +WebAssembly/WASI Support in Ruby intends to leverage those projects. It enables Ruby developers to write applications which runs on such promised platform. + +### Use case + +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. + +### Technical points + +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. + +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. + + +### Related links + +* [Add WASI based WebAssembly support #5407](https://github.com/ruby/ruby/pull/5407) +* [An Update on WebAssembly/WASI Support in Ruby](https://itnext.io/final-report-webassembly-wasi-support-in-ruby-4aface7d90c9) + +## Regexp timeout + +A timeout feature for Regexp matching is introduced. + +```ruby +Regexp.timeout = 1.0 + +/^a*b?a*$/ =~ "a" * 50000 + "x" +#=> Regexp::TimeoutError is raised in one second +``` + +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). + +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. + +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`. + +```ruby +Regexp.timeout = 1.0 + +# This regexp has no timeout +long_time_re = Regexp.new("^a*b?a*$", timeout: nil) + +long_time_re =~ "a" * 50000 + "x" # never interrupted +``` + +The original proposal is https://bugs.ruby-lang.org/issues/17837 + + +## Other Notable New Features + +### No longer bundle 3rd party sources + +* We no longer bundle 3rd party sources like `libyaml`, `libffi`. + + * 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. + + * libffi will be removed from `fiddle` at preview2 + +### Language + +* Find pattern is no longer experimental. + + +## Performance improvements + + + +## Other notable changes since 3.1 + +* Hash + * Hash#shift now always returns nil if the hash is + empty, instead of returning the default value or + calling the default proc. [[Bug #16908]] + +* MatchData + * MatchData#byteoffset has been added. [[Feature #13110]] + +* Module + * Module.used_refinements has been added. [[Feature #14332]] + * Module#refinements has been added. [[Feature #12737]] + * Module#const_added has been added. [[Feature #17881]] + +* Proc + * Proc#dup returns an instance of subclass. [[Bug #17545]] + * Proc#parameters now accepts lambda keyword. [[Feature #15357]] + +* Refinement + * Refinement#refined_class has been added. [[Feature #12737]] + +* Set + * Set is now available as a builtin class without the need for `require "set"`. [[Feature #16989]] + It is currently autoloaded via the `Set` constant or a call to `Enumerable#to_set`. + +* String + * String#byteindex and String#byterindex have been added. [[Feature #13110]] + * Update Unicode to Version 14.0.0 and Emoji Version 14.0. [[Feature #18037]] + (also applies to Regexp) + * String#bytesplice has been added. [[Feature #18598]] + +* Struct + * A Struct class can also be initialized with keyword arguments + without `keyword_init: true` on `Struct.new` [[Feature #16806]] + + +### Standard libraries updates + +* The following default gem are updated. + + * TBD + +* The following bundled gems are updated. + + * TBD + +* The following default gems are now bundled gems. You need to add the following libraries to `Gemfile` under the bundler environment. + + * TBD + +See [NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md) +or [commit logs](https://github.com/ruby/ruby/compare/v3_1_0...{{ release.tag }}) +for more details. + +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) +since Ruby 3.1.0! + +## Download + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## 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. diff --git a/ja/news/_posts/2022-04-03-ruby-3-2-0-preview1-released.md b/ja/news/_posts/2022-04-03-ruby-3-2-0-preview1-released.md new file mode 100644 index 0000000000..762888a0e4 --- /dev/null +++ b/ja/news/_posts/2022-04-03-ruby-3-2-0-preview1-released.md @@ -0,0 +1,140 @@ +--- +layout: news_post +title: "Ruby 3.2.0 Preview 1 リリース" +author: "naruse" +translator: +date: 2022-04-03 00:00:00 +0000 +lang: ja +--- + +Ruby 3.2系最初のプレビューリリースである、Ruby 3.2.0 Preview 1 が公開されました。Ruby 3.2では多くの機能を追加しています。 + +{% assign release = site.data.releases | where: "version", "3.2.0-preview1" | first %} + + +## WASIベースのWebAssemblyサポート + +WASIベースのWebAssemblyへのコンパイルがサポートされました。これにより、ブラウザやサーバーレスエッジ環境、その他のWebAssembly/WASI環境でCRubyのバイナリが利用できるようになります。現在この移植版はThread API以外のbasic testとbootstrap testをパスしています。 + +![](https://i.imgur.com/opCgKy2.png) + +### Background + +もともと[WebAssembly (WASM)](https://webassembly.org/)が導入されたのは、プログラムをブラウザの上で安全かつ高速に実行するためでした。しかし、様々な環境で安全かつ効率的にプログラムを実行するという目的は、Webだけでなく一般的なアプリケーションで長らく求められていたものです + +[WASI (The WebAssembly System Interface)](https://wasi.dev/)はそのようなユースケースのために設計されました。そのようなアプリケーションはOSと通信する必要がありますが、WebAssembly自体はシステムインターフェイスを持たないVMの上で実行されます。WASIはこのシステムインターフェイスを規格化します。 + +RubyのWebAssembly/WASIサポートは、このようなプロジェクトを活用することを狙っています。これにより、Ruby開発者がそのような有望なプラットフォームで動くアプリケーションを書けるようになります。 + +### ユースケース + +このサポートは、開発者がCRubyをWebAssembly環境で利用することを促進します。たとえば、[TryRuby playground](https://try.ruby-lang.org/playground/)のCRubyサポートです。CRubyをウェブブラウザの上で試すことができるようになりました。 + +### 技術的な話 + +現時点のWASIとWebAssemblyには、Fiberや例外やGCを実装するための機能に一部足りないものがあります。CRubyではこのギャップを埋めるために、ユーザランドで実行を制御できるAsyncifyというバイナリ変換技術を使っています。 + +さらに、[WASIの上にVFS](https://github.com/kateinoigakukun/wasi-vfs/wiki/Getting-Started-with-CRuby)を実装しました。これにより、Rubyアプリを単一の.wasmファイルに容易にパッケージ化できます。Rubyアプリの配布が少しかんたんになります。 + +### 参考文献 + +* [Add WASI based WebAssembly support #5407](https://github.com/ruby/ruby/pull/5407) +* [An Update on WebAssembly/WASI Support in Ruby](https://itnext.io/final-report-webassembly-wasi-support-in-ruby-4aface7d90c9) + +## Regexp timeout + +正規表現マッチングにタイムアウトを指定できるようになりました。 + +```ruby +Regexp.timeout = 1.0 + +/^a*b?a*$/ =~ "a" * 50000 + "x" #=> 1秒後にRegexp::TimeoutError +``` + +正規表現マッチングは予想外に時間がかかることがあることが知られています。もし信頼できない入力に対して非効率な可能性のある正規表現をマッチしていると、Denial of Service攻撃を効率的にできてしまう可能性があります(正規表現DoS、ReDoSなどと言われます)。 + +あなたのRubyアプリケーションの要件に基づいて適切に`Regexp.timeout`を設定することで、DoSのリスクを防止、または大幅に緩和できます。ぜひあなたのアプリケーションで試してみてください。フィードバックを歓迎します。 + +なお、Regexp.timeoutはグローバルな設定です。もし一部の特別な正規表現にだけ異なるタイムアウトを設定したい場合は、`Regexp.new`の`timeout`キーワードを指定してください。 + +```ruby +Regexp.timeout = 1.0 + +long_time_re = Regexp.new("^a*b?a*$", timeout: nil) # タイムアウトなし + +long_time_re =~ "a" * 50000 + "x" # 割り込まれない +``` + +機能提案のチケット:https://bugs.ruby-lang.org/issues/17837 + + +## その他の主要な新機能 + +### 言語機能 + +* Find patternが実験的機能ではなくなりました。 + + +### 非互換な変更 + +* `libyaml` や `libffi` のような 3rd パーティのライブラリのソースコードの同梱を廃止しました + + * Psych に同梱していた `libyaml` のソースコードは削除されました。ユーザーは自身で Ubuntu や Debian プラットフォームなら `libyaml-dev` パッケージをインストールする必要があります。このパッケージ名称はプラットフォームごとに異なります。 + + * Fiddle に同梱していた `libffi` のソースコードは preview2 で削除する予定です。 + + +## パフォーマンスの改善 + + + + +## その他の注目すべき 3.1 からの変更点 + + + + +## 標準添付ライブラリのアップデート + +* 以下の default gems のバージョンがアップデートされました。 + + * TBD + +* 以下の bundled gems のバージョンがアップデートされました。 + + * TBD + +* 以下のライブラリが新たに bundled gems になりました。Bundler から利用する場合は Gemfile に明示的に指定してください。 + + * TBD + +その他詳細については、[NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md) ファイルまたは[コミットログ](https://github.com/ruby/ruby/compare/v3_1_0...{{ release.tag }})を参照してください。 + +なお、こうした変更により、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) ! + +## ダウンロード + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Ruby とは + +Rubyはまつもとゆきひろ (Matz) によって1993年に開発が始められ、今もオープンソースソフトウェアとして開発が続けられています。Rubyは様々なプラットフォームで動き、世界中で、特にWebアプリケーション開発のために使われています。