diff options
Diffstat (limited to 'NEWS.md')
| -rw-r--r-- | NEWS.md | 360 |
1 files changed, 229 insertions, 131 deletions
@@ -1,170 +1,268 @@ -# NEWS for Ruby 3.4.0 +# NEWS for Ruby 4.1.0 This document is a list of user-visible feature changes -since the **3.3.0** release, except for bug fixes. +since the **4.0.0** release, except for bug fixes. Note that each entry is kept to a minimum, see links for details. ## Language changes -* String literals in files without a `frozen_string_literal` comment now emit a deprecation warning - when they are mutated. - These warnings can be enabled with `-W:deprecated` or by setting `Warning[:deprecated] = true`. - To disable this change, you can run Ruby with the `--disable-frozen-string-literal` - command line argument. [[Feature #20205]] +* `Module#clone` and `Module#dup` no longer rewrite the lexical scope of + copied methods. Constants and class variables resolve through the + original class, consistent with inheritance and mixins. + [[Feature #21981]] -* `it` is added to reference a block parameter. [[Feature #18980]] +## Core classes updates -* Keyword splatting `nil` when calling methods is now supported. - `**nil` is treated similarly to `**{}`, passing no keywords, - and not calling any conversion methods. [[Bug #20064]] +Note: We're only listing outstanding class updates. -* Block passing is no longer allowed in index assignment - (e.g. `a[0, &b] = 1`). [[Bug #19918]] +* Array -* Keyword arguments are no longer allowed in index assignment - (e.g. `a[0, kw: 1] = 2`). [[Bug #20218]] + * `Array#pack` accepts a new format `R` and `r` for unpacking unsigned + and signed LEB128 encoded integers. [[Feature #21785]] + * `Array#pack` accepts a new format `^` that returns the current offset. + Useful when combined with variable width formats like LEB128. [[Feature #21796]] -* `GC.config` added to allow setting configuration variables on the Garbage - Collector. [[Feature #20443]] +* ENV -* GC configuration parameter `rgengc_allow_full_mark` introduced. When `false` - GC will only mark young objects. Default is `true`. [[Feature #20443]] + * `ENV.fetch_values` is added. It returns an array of values for the + given names, raising `KeyError` for missing names unless a block is + given. [[Feature #21781]] -## Core classes updates +* Kernel -Note: We're only listing outstanding class updates. + * `Kernel#autoload_relative` and `Module#autoload_relative` are added. + These methods work like `autoload`, but resolve the file path relative + to the file where the method is called, similar to `require_relative`. + This makes it easier to autoload constants from files in the same + directory without hardcoding absolute paths or manipulating `$LOAD_PATH`. + [[Feature #15330]] -* Exception +* MatchData - * Exception#set_backtrace now accepts arrays of `Thread::Backtrace::Location`. - `Kernel#raise`, `Thread#raise` and `Fiber#raise` also accept this new format. [[Feature #13557]] + * `MatchData#integer_at` is added. It converts the matched substring to + integer and return the result. [[Feature #21932]] -* Range +* Regexp - * Range#size now raises TypeError if the range is not iterable. [[Misc #18984]] + * All instances of `Regexp` are now frozen, not just literals. + Subclasses of `Regexp` are not frozen for compatibility. + [[Feature #8948]] -* RubyVM::AbstractSyntaxTree +* Set - * Add `RubyVM::AbstractSyntaxTree::Node#locations` method which returns location objects - associated with the AST node. [[Feature #20624]] - * Add `RubyVM::AbstractSyntaxTree::Location` class which holds location information. [[Feature #20624]] + * A deprecated behavior, `Set#to_set`, `Range#to_set`, and + `Enumerable#to_set` accepting arguments, was removed. [[Feature #21390]] ## Stdlib updates -* Tempfile - - * The keyword argument `anonymous: true` is implemented for `Tempfile.create`. - `Tempfile.create(anonymous: true)` removes the created temporary file immediately. - So applications don't need to remove the file. - [[Feature #20497]] - -The following default gems are updated. - -* RubyGems 3.6.0.dev -* bundler 2.6.0.dev -* erb 4.0.4 -* fiddle 1.1.3 -* io-console 0.7.2 -* irb 1.14.0 -* json 2.7.2 -* net-http 0.4.1 -* optparse 0.5.0 -* prism 0.30.0 -* rdoc 6.7.0 -* reline 0.5.9 -* resolv 0.4.0 -* stringio 3.1.2 -* strscan 3.1.1 - -The following bundled gems are updated. - -* minitest 5.24.1 -* rake 13.2.1 -* test-unit 3.6.2 -* rexml 3.3.4 -* rss 0.3.1 -* net-ftp 0.3.7 -* net-imap 0.4.14 -* net-smtp 0.5.0 -* rbs 3.5.2 -* typeprof 0.21.11 -* debug 1.9.2 -* racc 1.8.1 - -The following bundled gems are promoted from default gems. - -* mutex_m 0.2.0 -* getoptlong 0.2.1 -* base64 0.2.0 -* bigdecimal 3.1.8 -* observer 0.1.2 -* abbrev 0.1.2 -* resolv-replace 0.1.1 -* rinda 0.2.0 -* drb 2.2.1 -* nkf 0.2.0 -* syslog 0.1.2 -* csv 3.3.0 - -See GitHub releases like [GitHub Releases of Logger](https://github.com/ruby/logger/releases) or changelog for details of the default gems or bundled gems. +### The following bundled gems are added. + + +We only list stdlib changes that are notable feature changes. + +Other changes are listed in the following sections. We also listed release +history from the previous bundled version that is Ruby 3.4.0 if it has GitHub +releases. + +### The following bundled gems are promoted from default gems. + +* tsort 0.2.0 +* win32-registry 0.1.2 + +### The following default gem is added. + +### The following default gems are updated. + +* RubyGems 4.1.0.dev + * 4.0.3 to [v4.0.4][RubyGems-v4.0.4], [v4.0.5][RubyGems-v4.0.5], [v4.0.6][RubyGems-v4.0.6], [v4.0.7][RubyGems-v4.0.7], [v4.0.8][RubyGems-v4.0.8], [v4.0.9][RubyGems-v4.0.9], [v4.0.10][RubyGems-v4.0.10], [v4.0.11][RubyGems-v4.0.11], [v4.0.12][RubyGems-v4.0.12], [v4.0.13][RubyGems-v4.0.13] +* bundler 4.1.0.dev + * 4.0.3 to [v4.0.4][bundler-v4.0.4], [v4.0.5][bundler-v4.0.5], [v4.0.6][bundler-v4.0.6], [v4.0.7][bundler-v4.0.7], [v4.0.8][bundler-v4.0.8], [v4.0.9][bundler-v4.0.9], [v4.0.10][bundler-v4.0.10], [v4.0.11][bundler-v4.0.11], [v4.0.12][bundler-v4.0.12], [v4.0.13][bundler-v4.0.13] +* erb 6.0.4 + * 6.0.1 to [v6.0.1.1][erb-v6.0.1.1], [v6.0.2][erb-v6.0.2], [v6.0.3][erb-v6.0.3], [v6.0.4][erb-v6.0.4] +* ipaddr 1.2.9 + * 1.2.8 to [v1.2.9][ipaddr-v1.2.9] +* json 2.19.8 + * 2.18.0 to [v2.18.1][json-v2.18.1], [v2.19.0][json-v2.19.0], [v2.19.1][json-v2.19.1], [v2.19.2][json-v2.19.2], [v2.19.3][json-v2.19.3], [v2.19.4][json-v2.19.4], [v2.19.5][json-v2.19.5], [v2.19.6][json-v2.19.6], [v2.19.7][json-v2.19.7] +* openssl 4.0.2 + * 4.0.0 to [v4.0.1][openssl-v4.0.1], [v4.0.2][openssl-v4.0.2] +* prism 1.9.0 + * 1.7.0 to [v1.8.0][prism-v1.8.0], [v1.8.1][prism-v1.8.1], [v1.9.0][prism-v1.9.0] +* psych 5.4.0 +* resolv 0.7.1 + * 0.7.0 to [v0.7.1][resolv-v0.7.1] +* stringio 3.2.1.dev +* strscan 3.1.9.dev + * 3.1.6 to [v3.1.7][strscan-v3.1.7], [v3.1.8][strscan-v3.1.8] +* syntax_suggest 3.0.0 +* timeout 0.6.1 + * 0.6.0 to [v0.6.1][timeout-v0.6.1] +* zlib 3.2.3 + * 3.2.2 to [v3.2.3][zlib-v3.2.3] + +### The following bundled gems are updated. + +* minitest 6.0.6 +* rake 13.4.2 + * 13.3.1 to [v13.4.0][rake-v13.4.0], [v13.4.1][rake-v13.4.1], [v13.4.2][rake-v13.4.2] +* test-unit 3.7.7 + * 3.7.5 to [3.7.6][test-unit-3.7.6], [3.7.7][test-unit-3.7.7] +* net-imap 0.6.4 + * 0.6.2 to [v0.6.3][net-imap-v0.6.3], [v0.6.4][net-imap-v0.6.4] +* rbs 4.0.2 + * 3.10.0 to [v3.10.1][rbs-v3.10.1], [v3.10.2][rbs-v3.10.2], [v3.10.3][rbs-v3.10.3], [v3.10.4][rbs-v3.10.4], [v4.0.0.dev.5][rbs-v4.0.0.dev.5], [v4.0.0][rbs-v4.0.0], [v4.0.2][rbs-v4.0.2] +* typeprof 0.32.0 +* mutex_m 0.3.0 +* bigdecimal 4.1.2 + * 4.0.1 to [v4.1.0][bigdecimal-v4.1.0], [v4.1.1][bigdecimal-v4.1.1], [v4.1.2][bigdecimal-v4.1.2] +* resolv-replace 0.2.0 + * 0.1.1 to [v0.2.0][resolv-replace-v0.2.0] +* syslog 0.4.0 + * 0.3.0 to [v0.4.0][syslog-v0.4.0] +* repl_type_completor 0.1.15 + * 0.1.12 to [v0.1.13][repl_type_completor-v0.1.13], [v0.1.14][repl_type_completor-v0.1.14], [v0.1.15][repl_type_completor-v0.1.15] +* pstore 0.2.1 + * 0.2.0 to [v0.2.1][pstore-v0.2.1] +* rdoc 7.2.0 + * 7.0.3 to [v7.0.4][rdoc-v7.0.4], [v7.1.0][rdoc-v7.1.0], [v7.2.0][rdoc-v7.2.0] +* win32ole 1.9.3 + * 1.9.2 to [v1.9.3][win32ole-v1.9.3] +* irb 1.18.0 + * 1.16.0 to [v1.17.0][irb-v1.17.0], [v1.18.0][irb-v1.18.0] + +### RubyGems and Bundler + +Ruby 4.0 bundled RubyGems and Bundler version 4. see the following links for details. ## Supported platforms ## Compatibility issues -* Error messages and backtrace displays have been changed. - * Use a single quote instead of a backtick as a opening quote. [[Feature #16495]] - * Display a class name before a method name (only when the class has a permanent name). [[Feature #19117]] - * `Kernel#caller`, `Thread::Backtrace::Location`'s methods, etc. are also changed accordingly. - ``` - Old: - test.rb:1:in `foo': undefined method `time' for an instance of Integer - from test.rb:2:in `<main>' - - New: - test.rb:1:in 'Object#foo': undefined method 'time' for an instance of Integer - from test.rb:2:in `<main>' - ``` - ## Stdlib compatibility issues ## C API updates -* `rb_newobj` and `rb_newobj_of` (and corresponding macros `RB_NEWOBJ`, `RB_NEWOBJ_OF`, `NEWOBJ`, `NEWOBJ_OF`) have been removed. [[Feature #20265]] -* Removed deprecated function `rb_gc_force_recycle`. [[Feature #18290]] +### Embedded TypedData + +* The `RUBY_TYPED_EMBEDDABLE` flag is now public and documented and can be used by C extensions. + It allows allocating C structs directly into Ruby object slots, which reduces pointer chasing, + and in some case memory usage. + See the C extension documentation for details. [[Feature #21853]] + +* Added new C23 inspired allocator functions, that takes the previous memory size. + This allow the Ruby GC to better keep track of memory usage, improving its heuristics. + It also improves the performance of system allocators that support C23 `free_sized`. + + However, it is important to note that passing an incorrect size to these function is undefined + behavior and may result in crashes or memory leaks. + + - `ruby_xfree_sized(void *ptr, size_t size)` + - `ruby_xrealloc_sized(void *ptr, size_t newsiz, size_t oldsiz)` + - `ruby_xrealloc2_sized(void *ptr, size_t newelems, size_t newsiz, size_t oldelems)` + + [[Feature #21861]] + +### Removed APIs + +The following APIs, which have been deprecated for many years, are removed. +[[Feature #21768]] + +* old postponed job functions, +* untyped data object type/functions, +* old APIs to allocate a data object, +* taintedness/trustedness enums/macros, +* `rb_gc_force_recycle` function, +* `rb_iterate` function, +* and some functions and constants for internal use. ## Implementation improvements -* `Array#each` is rewritten in Ruby for better performance [[Feature #20182]]. +### Ractor + +A lot of work has gone into making Ractors more stable, performant, and usable. These improvements bring Ractor implementation closer to leaving experimental status. ## JIT -## Miscellaneous changes - -* Passing a block to a method which doesn't use the passed block will show - a warning on verbose mode (`-w`). - [[Feature #15554]] - -* Redefining some core methods that are specially optimized by the interpreter - and JIT like `String.freeze` or `Integer#+` now emits a performance class - warning (`-W:performance` or `Warning[:performance] = true`). - [[Feature #20429]] - -[Feature #13557]: https://bugs.ruby-lang.org/issues/13557 -[Feature #15554]: https://bugs.ruby-lang.org/issues/15554 -[Feature #16495]: https://bugs.ruby-lang.org/issues/16495 -[Feature #18290]: https://bugs.ruby-lang.org/issues/18290 -[Feature #18980]: https://bugs.ruby-lang.org/issues/18980 -[Misc #18984]: https://bugs.ruby-lang.org/issues/18984 -[Feature #19117]: https://bugs.ruby-lang.org/issues/19117 -[Bug #19918]: https://bugs.ruby-lang.org/issues/19918 -[Bug #20064]: https://bugs.ruby-lang.org/issues/20064 -[Feature #20182]: https://bugs.ruby-lang.org/issues/20182 -[Feature #20205]: https://bugs.ruby-lang.org/issues/20205 -[Bug #20218]: https://bugs.ruby-lang.org/issues/20218 -[Feature #20265]: https://bugs.ruby-lang.org/issues/20265 -[Feature #20429]: https://bugs.ruby-lang.org/issues/20429 -[Feature #20443]: https://bugs.ruby-lang.org/issues/20443 -[Feature #20497]: https://bugs.ruby-lang.org/issues/20497 -[Feature #20624]: https://bugs.ruby-lang.org/issues/20624 +[Feature #8948]: https://bugs.ruby-lang.org/issues/8948 +[Feature #15330]: https://bugs.ruby-lang.org/issues/15330 +[Feature #21390]: https://bugs.ruby-lang.org/issues/21390 +[Feature #21768]: https://bugs.ruby-lang.org/issues/21768 +[Feature #21785]: https://bugs.ruby-lang.org/issues/21785 +[Feature #21796]: https://bugs.ruby-lang.org/issues/21796 +[Feature #21853]: https://bugs.ruby-lang.org/issues/21853 +[Feature #21861]: https://bugs.ruby-lang.org/issues/21861 +[Feature #21932]: https://bugs.ruby-lang.org/issues/21932 +[Feature #21981]: https://bugs.ruby-lang.org/issues/21981 +[RubyGems-v4.0.4]: https://github.com/rubygems/rubygems/releases/tag/v4.0.4 +[RubyGems-v4.0.5]: https://github.com/rubygems/rubygems/releases/tag/v4.0.5 +[RubyGems-v4.0.6]: https://github.com/rubygems/rubygems/releases/tag/v4.0.6 +[RubyGems-v4.0.7]: https://github.com/rubygems/rubygems/releases/tag/v4.0.7 +[RubyGems-v4.0.8]: https://github.com/rubygems/rubygems/releases/tag/v4.0.8 +[RubyGems-v4.0.9]: https://github.com/rubygems/rubygems/releases/tag/v4.0.9 +[RubyGems-v4.0.10]: https://github.com/rubygems/rubygems/releases/tag/v4.0.10 +[RubyGems-v4.0.11]: https://github.com/rubygems/rubygems/releases/tag/v4.0.11 +[RubyGems-v4.0.12]: https://github.com/rubygems/rubygems/releases/tag/v4.0.12 +[RubyGems-v4.0.13]: https://github.com/rubygems/rubygems/releases/tag/v4.0.13 +[bundler-v4.0.4]: https://github.com/rubygems/rubygems/releases/tag/bundler-v4.0.4 +[bundler-v4.0.5]: https://github.com/rubygems/rubygems/releases/tag/bundler-v4.0.5 +[bundler-v4.0.6]: https://github.com/rubygems/rubygems/releases/tag/bundler-v4.0.6 +[bundler-v4.0.7]: https://github.com/rubygems/rubygems/releases/tag/bundler-v4.0.7 +[bundler-v4.0.8]: https://github.com/rubygems/rubygems/releases/tag/bundler-v4.0.8 +[bundler-v4.0.9]: https://github.com/rubygems/rubygems/releases/tag/bundler-v4.0.9 +[bundler-v4.0.10]: https://github.com/rubygems/rubygems/releases/tag/bundler-v4.0.10 +[bundler-v4.0.11]: https://github.com/rubygems/rubygems/releases/tag/bundler-v4.0.11 +[bundler-v4.0.12]: https://github.com/rubygems/rubygems/releases/tag/bundler-v4.0.12 +[bundler-v4.0.13]: https://github.com/rubygems/rubygems/releases/tag/bundler-v4.0.13 +[erb-v6.0.1.1]: https://github.com/ruby/erb/releases/tag/v6.0.1.1 +[erb-v6.0.2]: https://github.com/ruby/erb/releases/tag/v6.0.2 +[erb-v6.0.3]: https://github.com/ruby/erb/releases/tag/v6.0.3 +[erb-v6.0.4]: https://github.com/ruby/erb/releases/tag/v6.0.4 +[ipaddr-v1.2.9]: https://github.com/ruby/ipaddr/releases/tag/v1.2.9 +[json-v2.18.1]: https://github.com/ruby/json/releases/tag/v2.18.1 +[json-v2.19.0]: https://github.com/ruby/json/releases/tag/v2.19.0 +[json-v2.19.1]: https://github.com/ruby/json/releases/tag/v2.19.1 +[json-v2.19.2]: https://github.com/ruby/json/releases/tag/v2.19.2 +[json-v2.19.3]: https://github.com/ruby/json/releases/tag/v2.19.3 +[json-v2.19.4]: https://github.com/ruby/json/releases/tag/v2.19.4 +[json-v2.19.5]: https://github.com/ruby/json/releases/tag/v2.19.5 +[json-v2.19.6]: https://github.com/ruby/json/releases/tag/v2.19.6 +[json-v2.19.7]: https://github.com/ruby/json/releases/tag/v2.19.7 +[openssl-v4.0.1]: https://github.com/ruby/openssl/releases/tag/v4.0.1 +[openssl-v4.0.2]: https://github.com/ruby/openssl/releases/tag/v4.0.2 +[prism-v1.8.0]: https://github.com/ruby/prism/releases/tag/v1.8.0 +[prism-v1.8.1]: https://github.com/ruby/prism/releases/tag/v1.8.1 +[prism-v1.9.0]: https://github.com/ruby/prism/releases/tag/v1.9.0 +[resolv-v0.7.1]: https://github.com/ruby/resolv/releases/tag/v0.7.1 +[strscan-v3.1.7]: https://github.com/ruby/strscan/releases/tag/v3.1.7 +[strscan-v3.1.8]: https://github.com/ruby/strscan/releases/tag/v3.1.8 +[timeout-v0.6.1]: https://github.com/ruby/timeout/releases/tag/v0.6.1 +[zlib-v3.2.3]: https://github.com/ruby/zlib/releases/tag/v3.2.3 +[rake-v13.4.0]: https://github.com/ruby/rake/releases/tag/v13.4.0 +[rake-v13.4.1]: https://github.com/ruby/rake/releases/tag/v13.4.1 +[rake-v13.4.2]: https://github.com/ruby/rake/releases/tag/v13.4.2 +[test-unit-3.7.6]: https://github.com/test-unit/test-unit/releases/tag/3.7.6 +[test-unit-3.7.7]: https://github.com/test-unit/test-unit/releases/tag/3.7.7 +[net-imap-v0.6.3]: https://github.com/ruby/net-imap/releases/tag/v0.6.3 +[net-imap-v0.6.4]: https://github.com/ruby/net-imap/releases/tag/v0.6.4 +[rbs-v3.10.1]: https://github.com/ruby/rbs/releases/tag/v3.10.1 +[rbs-v3.10.2]: https://github.com/ruby/rbs/releases/tag/v3.10.2 +[rbs-v3.10.3]: https://github.com/ruby/rbs/releases/tag/v3.10.3 +[rbs-v3.10.4]: https://github.com/ruby/rbs/releases/tag/v3.10.4 +[rbs-v4.0.0.dev.5]: https://github.com/ruby/rbs/releases/tag/v4.0.0.dev.5 +[rbs-v4.0.0]: https://github.com/ruby/rbs/releases/tag/v4.0.0 +[rbs-v4.0.2]: https://github.com/ruby/rbs/releases/tag/v4.0.2 +[bigdecimal-v4.1.0]: https://github.com/ruby/bigdecimal/releases/tag/v4.1.0 +[bigdecimal-v4.1.1]: https://github.com/ruby/bigdecimal/releases/tag/v4.1.1 +[bigdecimal-v4.1.2]: https://github.com/ruby/bigdecimal/releases/tag/v4.1.2 +[resolv-replace-v0.2.0]: https://github.com/ruby/resolv-replace/releases/tag/v0.2.0 +[syslog-v0.4.0]: https://github.com/ruby/syslog/releases/tag/v0.4.0 +[repl_type_completor-v0.1.13]: https://github.com/ruby/repl_type_completor/releases/tag/v0.1.13 +[repl_type_completor-v0.1.14]: https://github.com/ruby/repl_type_completor/releases/tag/v0.1.14 +[repl_type_completor-v0.1.15]: https://github.com/ruby/repl_type_completor/releases/tag/v0.1.15 +[pstore-v0.2.1]: https://github.com/ruby/pstore/releases/tag/v0.2.1 +[rdoc-v7.0.4]: https://github.com/ruby/rdoc/releases/tag/v7.0.4 +[rdoc-v7.1.0]: https://github.com/ruby/rdoc/releases/tag/v7.1.0 +[rdoc-v7.2.0]: https://github.com/ruby/rdoc/releases/tag/v7.2.0 +[win32ole-v1.9.3]: https://github.com/ruby/win32ole/releases/tag/v1.9.3 +[irb-v1.17.0]: https://github.com/ruby/irb/releases/tag/v1.17.0 +[irb-v1.18.0]: https://github.com/ruby/irb/releases/tag/v1.18.0 |
