From 01776e26166d71669c6d36646909acdd3674d7b7 Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Sat, 12 Nov 2022 00:11:23 +0900 Subject: [PATCH] Ruby 3.2.0 Preview 3 Released --- _data/downloads.yml | 2 +- _data/releases.yml | 29 ++ ...2022-11-11-ruby-3-2-0-preview3-released.md | 401 ++++++++++++++++++ ...2022-11-11-ruby-3-2-0-preview3-released.md | 246 +++++++++++ 4 files changed, 677 insertions(+), 1 deletion(-) create mode 100644 en/news/_posts/2022-11-11-ruby-3-2-0-preview3-released.md create mode 100644 ja/news/_posts/2022-11-11-ruby-3-2-0-preview3-released.md diff --git a/_data/downloads.yml b/_data/downloads.yml index 7cc85bfd2c..11a3db17e3 100644 --- a/_data/downloads.yml +++ b/_data/downloads.yml @@ -4,7 +4,7 @@ # optional preview: - - 3.2.0-preview2 + - 3.2.0-preview3 stable: diff --git a/_data/releases.yml b/_data/releases.yml index 8f81a49edd..d3920f3f95 100644 --- a/_data/releases.yml +++ b/_data/releases.yml @@ -21,6 +21,35 @@ # 3.2 series +- version: 3.2.0-preview3 + date: 2022-11-11 + post: /en/news/2022/11/11/ruby-3-2-0-preview3-released/ + tag: v3_2_0_preview3 + stats: + files_changed: 2719 + insertions: 191269 + deletions: 120315 + url: + gz: https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0-preview3.tar.gz + zip: https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0-preview3.zip + xz: https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0-preview3.tar.xz + size: + gz: 20086542 + zip: 24426893 + xz: 14799804 + sha1: + gz: dafca8116d36ceaa32482ab38359768de8c3ae5e + zip: 346c051c4be7ab8d0b551fd2ff8169785697db62 + xz: c94e2add05502cb5c39afffc995b7c8f000f7df0 + sha256: + gz: c041d1488e62730d3a10dbe7cf7a3b3e4268dc867ec20ec991e7d16146640487 + zip: cf49aa70e7ebd8abebffd5e49cd3bd92e5b9f3782d587cc7ed88c98dd5f17069 + xz: d3f5619de544240d92a5d03aa289e71bd1103379622c523a0e80ed029a74b3bb + sha512: + gz: 860634d95e4b9c48f18d38146dfbdc3c389666d45454248a4ccdfc3a5d3cd0c71c73533aabf359558117de9add1472af228d8eaec989c9336b1a3a6f03f1ae88 + zip: 4f22b5ea91be17ef5f68cf0acb1e3a226dcc549ad71cc9b40e623220087c4065ca9bea942710f668e5c94ca0323da8d2ccd565f95a9085c1a0e38e9c0543b22f + xz: c1864e2e07c3711eaa17d0f85dfbcc6e0682b077782bb1c155315af45139ae66dc4567c73682d326975b0f472111eb0a70f949811cb54bed0b3a816ed6ac34df + - version: 3.2.0-preview2 date: 2022-09-09 post: /en/news/2022/09/09/ruby-3-2-0-preview2-released/ diff --git a/en/news/_posts/2022-11-11-ruby-3-2-0-preview3-released.md b/en/news/_posts/2022-11-11-ruby-3-2-0-preview3-released.md new file mode 100644 index 0000000000..e47d95f325 --- /dev/null +++ b/en/news/_posts/2022-11-11-ruby-3-2-0-preview3-released.md @@ -0,0 +1,401 @@ +--- +layout: news_post +title: "Ruby 3.2.0 Preview 3 Released" +author: "naruse" +translator: +date: 2022-11-11 00:00:00 +0000 +lang: en +--- + +{% assign release = site.data.releases | where: "version", "3.2.0-preview3" | 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 improvements against ReDoS + +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). + +We have introduced two improvements that significantly mitigate ReDoS. + +### Improved Regexp matching algorithm + +Since Ruby 3.2, Regexp's matching algorithm has been greatly improved by using memoization technique. + +``` +# This matching takes 10 sec. in Ruby 3.1, and does 0.003 sec. in Ruby 3.2 + +/^a*b?a*$/ =~ "a" * 50000 + "x" +``` + +The improved matching algorithm allows most of Regexp matching (about 90% in our experiments) to be completed in linear time. + +(For preview users: this optimization may consume memory proportional to the input length for each matching. We expect no practical problems to arise because this memory allocation is usually delayed, and a normal Regexp matching should consume at most 10 times as much memory as the input length. If you run out of memory when matching Regexps in a real-world application, please report it.) + +The original proposal is https://bugs.ruby-lang.org/issues/19104 + +### Regexp timeout + +The optimization above cannot be applied to some kind of regular expressions, such as including advanced features (e.g., back-references or look-around), or with huge fixed number of repetitions. As a fallback measure, a timeout feature for Regexp matching is also introduced. + +```ruby +Regexp.timeout = 1.0 + +/^a*b?a*()\1$/ =~ "a" * 50000 + "x" +#=> Regexp::TimeoutError is raised in one second +``` + +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*()\1$", timeout: Float::INFINITY) + +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. + + * bundled libffi source is also removed from `fiddle` + +### Language + +* Anonymous rest and keyword rest arguments can now be passed as + arguments, instead of just used in method parameters. + [[Feature #18351]] + + ```ruby + def foo(*) + bar(*) + end + def baz(**) + quux(**) + end + ``` + +* A proc that accepts a single positional argument and keywords will + no longer autosplat. [[Bug #18633]] + + ```ruby + proc{|a, **k| a}.call([1, 2]) + # Ruby 3.1 and before + # => 1 + # Ruby 3.2 and after + # => [1, 2] + ``` + +* Constant assignment evaluation order for constants set on explicit + objects has been made consistent with single attribute assignment + evaluation order. With this code: + + ```ruby + foo::BAR = baz + ``` + + `foo` is now called before `baz`. Similarly, for multiple assignments + to constants, left-to-right evaluation order is used. With this + code: + + ```ruby + foo1::BAR1, foo2::BAR2 = baz1, baz2 + ``` + + The following evaluation order is now used: + + 1. `foo1` + 2. `foo2` + 3. `baz1` + 4. `baz2` + + [[Bug #15928]] + +* Find pattern is no longer experimental. + [[Feature #18585]] + +* Methods taking a rest parameter (like `*args`) and wishing to delegate keyword + arguments through `foo(*args)` must now be marked with `ruby2_keywords` + (if not already the case). In other words, all methods wishing to delegate + keyword arguments through `*args` must now be marked with `ruby2_keywords`, + with no exception. This will make it easier to transition to other ways of + delegation once a library can require Ruby 3+. Previously, the `ruby2_keywords` + flag was kept if the receiving method took `*args`, but this was a bug and an + inconsistency. A good technique to find the potentially-missing `ruby2_keywords` + is to run the test suite, for where it fails find the last method which must + receive keyword arguments, use `puts nil, caller, nil` there, and check each + method/block on the call chain which must delegate keywords is correctly marked + as `ruby2_keywords`. [[Bug #18625]] [[Bug #16466]] + + ```ruby + def target(**kw) + end + + # Accidentally worked without ruby2_keywords in Ruby 2.7-3.1, ruby2_keywords + # needed in 3.2+. Just like (*args, **kwargs) or (...) would be needed on + # both #foo and #bar when migrating away from ruby2_keywords. + ruby2_keywords def bar(*args) + target(*args) + end + + ruby2_keywords def foo(*args) + bar(*args) + end + + foo(k: 1) + ``` + +## Performance improvements + +### YJIT + +* Support arm64 / aarch64 on UNIX platforms. +* Building YJIT requires Rust 1.58.1+. [[Feature #18481]] + +## 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]] + +* RubyVM::AbstractSyntaxTree + * Add `error_tolerant` option for `parse`, `parse_file` and `of`. [[Feature #19013]] + +* 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]] + +## Compatibility issues + +Note: Excluding feature bug fixes. + +### Removed constants + +The following deprecated constants are removed. + +* `Fixnum` and `Bignum` [[Feature #12005]] +* `Random::DEFAULT` [[Feature #17351]] +* `Struct::Group` +* `Struct::Passwd` + +### Removed methods + +The following deprecated methods are removed. + +* `Dir.exists?` [[Feature #17391]] +* `File.exists?` [[Feature #17391]] +* `Kernel#=~` [[Feature #15231]] +* `Kernel#taint`, `Kernel#untaint`, `Kernel#tainted?` + [[Feature #16131]] +* `Kernel#trust`, `Kernel#untrust`, `Kernel#untrusted?` + [[Feature #16131]] + +## Stdlib compatibility issues + +* `Psych` no longer bundles libyaml sources. + Users need to install the libyaml library themselves via the package + system. [[Feature #18571]] + +## C API updates + +### Updated C APIs + +The following APIs are updated. + +* PRNG update + `rb_random_interface_t` updated and versioned. + Extension libraries which use this interface and built for older versions. + Also `init_int32` function needs to be defined. + +### Removed C APIs + +The following deprecated APIs are removed. + +* `rb_cData` variable. +* "taintedness" and "trustedness" functions. [[Feature #16131]] + +### Standard libraries updates + +* SyntaxSuggest + + * The feature of `syntax_suggest` formerly `dead_end` is integrated in Ruby. + [[Feature #18159]] + +* ErrorHighlight + * Now it points an argument(s) of TypeError and ArgumentError + +``` +test.rb:2:in `+': nil can't be coerced into Integer (TypeError) + +sum = ary[0] + ary[1] + ^^^^^^ +``` + +* The following default gems are updated. + * RubyGems 3.4.0.dev + * bigdecimal 3.1.2 + * bundler 2.4.0.dev + * cgi 0.3.2 + * date 3.2.3 + * error_highlight 0.4.0 + * etc 1.4.0 + * io-console 0.5.11 + * io-nonblock 0.1.1 + * io-wait 0.3.0.pre + * ipaddr 1.2.4 + * json 2.6.2 + * logger 1.5.1 + * net-http 0.2.2 + * net-protocol 0.1.3 + * ostruct 0.5.5 + * psych 5.0.0.dev + * reline 0.3.1 + * securerandom 0.2.0 + * set 1.0.3 + * stringio 3.0.3 + * syntax_suggest 0.0.1 + * timeout 0.3.0 +* The following bundled gems are updated. + * minitest 5.16.3 + * net-imap 0.2.3 + * rbs 2.6.0 + * typeprof 0.21.3 + * debug 1.6.2 +* The following default gems are now bundled gems. + +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. + + + +[Feature #12005]: https://bugs.ruby-lang.org/issues/12005 +[Feature #12655]: https://bugs.ruby-lang.org/issues/12655 +[Feature #12737]: https://bugs.ruby-lang.org/issues/12737 +[Feature #13110]: https://bugs.ruby-lang.org/issues/13110 +[Feature #14332]: https://bugs.ruby-lang.org/issues/14332 +[Feature #15231]: https://bugs.ruby-lang.org/issues/15231 +[Feature #15357]: https://bugs.ruby-lang.org/issues/15357 +[Bug #15928]: https://bugs.ruby-lang.org/issues/15928 +[Feature #16131]: https://bugs.ruby-lang.org/issues/16131 +[Bug #16466]: https://bugs.ruby-lang.org/issues/16466 +[Feature #16806]: https://bugs.ruby-lang.org/issues/16806 +[Bug #16889]: https://bugs.ruby-lang.org/issues/16889 +[Bug #16908]: https://bugs.ruby-lang.org/issues/16908 +[Feature #16989]: https://bugs.ruby-lang.org/issues/16989 +[Feature #17351]: https://bugs.ruby-lang.org/issues/17351 +[Feature #17391]: https://bugs.ruby-lang.org/issues/17391 +[Bug #17545]: https://bugs.ruby-lang.org/issues/17545 +[Feature #17881]: https://bugs.ruby-lang.org/issues/17881 +[Feature #18037]: https://bugs.ruby-lang.org/issues/18037 +[Feature #18159]: https://bugs.ruby-lang.org/issues/18159 +[Feature #18351]: https://bugs.ruby-lang.org/issues/18351 +[Bug #18487]: https://bugs.ruby-lang.org/issues/18487 +[Feature #18571]: https://bugs.ruby-lang.org/issues/18571 +[Feature #18585]: https://bugs.ruby-lang.org/issues/18585 +[Feature #18598]: https://bugs.ruby-lang.org/issues/18598 +[Bug #18625]: https://bugs.ruby-lang.org/issues/18625 +[Bug #18633]: https://bugs.ruby-lang.org/issues/18633 +[Feature #18685]: https://bugs.ruby-lang.org/issues/18685 +[Bug #18782]: https://bugs.ruby-lang.org/issues/18782 +[Feature #18788]: https://bugs.ruby-lang.org/issues/18788 +[Feature #18809]: https://bugs.ruby-lang.org/issues/18809 +[Feature #18481]: https://bugs.ruby-lang.org/issues/18481 +[Bug #19100]: https://bugs.ruby-lang.org/issues/19100 +[Bug #19013]: https://bugs.ruby-lang.org/issues/19013 diff --git a/ja/news/_posts/2022-11-11-ruby-3-2-0-preview3-released.md b/ja/news/_posts/2022-11-11-ruby-3-2-0-preview3-released.md new file mode 100644 index 0000000000..c58cc4bbf8 --- /dev/null +++ b/ja/news/_posts/2022-11-11-ruby-3-2-0-preview3-released.md @@ -0,0 +1,246 @@ +--- +layout: news_post +title: "Ruby 3.2.0 Preview 3 リリース" +author: "naruse" +translator: +date: 2022-11-11 00:00:00 +0000 +lang: ja +--- + +Ruby 3.2系最初のプレビューリリースである、Ruby 3.2.0 Preview 3 が公開されました。Ruby 3.2では多くの機能を追加しています。 + +{% assign release = site.data.releases | where: "version", "3.2.0-preview3" | 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) + +## ReDoSに対するRegexpの改善 + +正規表現マッチングは予想外に時間がかかることがあることが知られています。もし信頼できない入力に対して非効率な可能性のある正規表現をマッチしていると、Denial of Service攻撃を効率的にできてしまう可能性があります(正規表現DoS、ReDoSなどと言われます)。 + +Ruby 3.2では、ReDoSを大幅に軽減する2つの改善を導入しました。 + +### Regexpのマッチングアルゴリズムの改善 + +Ruby 3.2から、Regexpのマッチングアルゴリズム自体がメモ化の最適化によって大幅に改善されました。 + +``` +# 次のマッチングはRuby 3.1では10秒かかりますが、Ruby 3.2では0.003秒で終わります + +/^a*b?a*$/ =~ "a" * 50000 + "x" +``` + +このアルゴリズムの改善で、ほとんどの(我々の実験では90%程度の)正規表現が線形時間でマッチ判定できるようになります。 + +(プレビューリリースのユーザへ:この最適化は、マッチングのたびに入力長に比例したメモリを消費することがあります。このメモリ確保は通常遅延され、また、通常の正規表現であれば入力長のたかだか10倍程度のメモリを消費するだけなので、実用上の問題は発生しないと考えています。もし実アプリの正規表現マッチングでメモリ不足に陥った場合は報告してください) + +提案チケットは https://bugs.ruby-lang.org/issues/19104 です。 + +### Regexpのタイムアウトの導入 + +上記の最適化は、ある種の正規表現には適用できません。たとえば、後方参照や先読み・後読みのような発展的機能や、非常に大きい固定回数繰り返しを使っている場合には適用されません。この場合の対策として、正規表現マッチングのタイムアウト機能が導入されました。 + +```ruby +Regexp.timeout = 1.0 + +/^a*b?a*()\1$/ =~ "a" * 50000 + "x" +#=> 1秒後にRegexp::TimeoutError +``` + +なお、Regexp.timeoutはグローバルな設定です。もし一部の特別な正規表現にだけ異なるタイムアウトを設定したい場合は、`Regexp.new`の`timeout`キーワードを指定してください。 + +```ruby +Regexp.timeout = 1.0 + +# This regexp has no timeout +long_time_re = Regexp.new("^a*b?a*()\1$", timeout: Float::INFINITY) + +long_time_re =~ "a" * 50000 + "x" # never interrupted +``` + +提案チケットは https://bugs.ruby-lang.org/issues/17837 です。 + +## その他の主要な新機能 + +### 言語機能 + +* Find patternが実験的機能ではなくなりました。 + + +### 3rd パーティライブラリのソースコード同梱廃止 + +* `libyaml` や `libffi` のような 3rd パーティのライブラリのソースコードの同梱を廃止しました + + * Psych に同梱していた `libyaml` のソースコードは削除されました。ユーザーは自身で Ubuntu や Debian プラットフォームなら `libyaml-dev` パッケージをインストールする必要があります。このパッケージ名称はプラットフォームごとに異なります。 + + * Fiddle に同梱していた `libffi` のソースコードも削除されました + + +## パフォーマンスの改善 + +### YJIT + +* Support arm64 / aarch64 on UNIX platforms. +* Building YJIT requires Rust 1.58.1+. [[Feature #18481]] + +## その他の注目すべき 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]] + +* RubyVM::AbstractSyntaxTree + * Add `error_tolerant` option for `parse`, `parse_file` and `of`. [[Feature #19013]] + +* 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]] + +## 標準添付ライブラリのアップデート + +* SyntaxSuggest + + * `syntax_suggest`(旧名:`dead_end`)という機能がRuby本体に統合されました。[[Feature #18159]] + +* ErrorHighlight + * TypeErrorとArgumentErrorの引数を下線表示するようになりました + +``` +test.rb:2:in `+': nil can't be coerced into Integer (TypeError) + +sum = ary[0] + ary[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アプリケーション開発のために使われています。 + + + +[Feature #12005]: https://bugs.ruby-lang.org/issues/12005 +[Feature #12655]: https://bugs.ruby-lang.org/issues/12655 +[Feature #12737]: https://bugs.ruby-lang.org/issues/12737 +[Feature #13110]: https://bugs.ruby-lang.org/issues/13110 +[Feature #14332]: https://bugs.ruby-lang.org/issues/14332 +[Feature #15231]: https://bugs.ruby-lang.org/issues/15231 +[Feature #15357]: https://bugs.ruby-lang.org/issues/15357 +[Bug #15928]: https://bugs.ruby-lang.org/issues/15928 +[Feature #16131]: https://bugs.ruby-lang.org/issues/16131 +[Bug #16466]: https://bugs.ruby-lang.org/issues/16466 +[Feature #16806]: https://bugs.ruby-lang.org/issues/16806 +[Bug #16889]: https://bugs.ruby-lang.org/issues/16889 +[Bug #16908]: https://bugs.ruby-lang.org/issues/16908 +[Feature #16989]: https://bugs.ruby-lang.org/issues/16989 +[Feature #17351]: https://bugs.ruby-lang.org/issues/17351 +[Feature #17391]: https://bugs.ruby-lang.org/issues/17391 +[Bug #17545]: https://bugs.ruby-lang.org/issues/17545 +[Feature #17881]: https://bugs.ruby-lang.org/issues/17881 +[Feature #18037]: https://bugs.ruby-lang.org/issues/18037 +[Feature #18159]: https://bugs.ruby-lang.org/issues/18159 +[Feature #18351]: https://bugs.ruby-lang.org/issues/18351 +[Bug #18487]: https://bugs.ruby-lang.org/issues/18487 +[Feature #18571]: https://bugs.ruby-lang.org/issues/18571 +[Feature #18585]: https://bugs.ruby-lang.org/issues/18585 +[Feature #18598]: https://bugs.ruby-lang.org/issues/18598 +[Bug #18625]: https://bugs.ruby-lang.org/issues/18625 +[Bug #18633]: https://bugs.ruby-lang.org/issues/18633 +[Feature #18685]: https://bugs.ruby-lang.org/issues/18685 +[Bug #18782]: https://bugs.ruby-lang.org/issues/18782 +[Feature #18788]: https://bugs.ruby-lang.org/issues/18788 +[Feature #18809]: https://bugs.ruby-lang.org/issues/18809 +[Feature #18481]: https://bugs.ruby-lang.org/issues/18481 +[Bug #19100]: https://bugs.ruby-lang.org/issues/19100 +[Bug #19013]: https://bugs.ruby-lang.org/issues/19013