|
| 1 | +--- |
| 2 | +layout: news_post |
| 3 | +title: "Ruby 3.4.0 preview1 Released" |
| 4 | +author: "naruse" |
| 5 | +translator: |
| 6 | +date: 2024-05-16 00:00:00 +0000 |
| 7 | +lang: en |
| 8 | +--- |
| 9 | + |
| 10 | +{% assign release = site.data.releases | where: "version", "3.4.0-preview1" | first %} |
| 11 | +We are pleased to announce the release of Ruby {{ release.version }}. |
| 12 | + |
| 13 | +## Language changes |
| 14 | + |
| 15 | +* String literals in files without a `frozen_string_literal` comment now behave |
| 16 | + as if they were frozen. If they are mutated a deprecation warning is emitted. |
| 17 | + These warnings can be enabled with `-W:deprecated` or by setting `Warning[:deprecated] = true`. |
| 18 | + To disable this change, you can run Ruby with the `--disable-frozen-string-literal` |
| 19 | + command line argument. [[Feature #20205]] |
| 20 | + |
| 21 | +* `it` is added to reference a block parameter. [[Feature #18980]] |
| 22 | + |
| 23 | +* Keyword splatting `nil` when calling methods is now supported. |
| 24 | + `**nil` is treated similarly to `**{}`, passing no keywords, |
| 25 | + and not calling any conversion methods. [[Bug #20064]] |
| 26 | + |
| 27 | +* Block passing is no longer allowed in index. [[Bug #19918]] |
| 28 | + |
| 29 | +* Keyword arguments are no longer allowed in index. [[Bug #20218]] |
| 30 | + |
| 31 | +## Core classes updates |
| 32 | + |
| 33 | +Note: We're only listing outstanding class updates. |
| 34 | + |
| 35 | +* Exception |
| 36 | + |
| 37 | + * Exception#set_backtrace now accepts arrays of `Thread::Backtrace::Location`. |
| 38 | + `Kernel#raise`, `Thread#raise` and `Fiber#raise` also accept this new format. [[Feature #13557]] |
| 39 | + |
| 40 | +* Range |
| 41 | + |
| 42 | + * Range#size now raises TypeError if the range is not iterable. [[Misc #18984]] |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +## Compatibility issues |
| 47 | + |
| 48 | +Note: Excluding feature bug fixes. |
| 49 | + |
| 50 | +* Error messages and backtrace displays have been changed. |
| 51 | + * Use a single quote instead of a backtick as a opening quote. [[Feature #16495]] |
| 52 | + * Display a class name before a method name (only when the class has a permanent name). [[Feature #19117]] |
| 53 | + * `Kernel#caller`, `Thread::Backtrace::Location`'s methods, etc. are also changed accordingly. |
| 54 | + ``` |
| 55 | + Old: |
| 56 | + test.rb:1:in `foo': undefined method `time' for an instance of Integer |
| 57 | + from test.rb:2:in `<main>' |
| 58 | +
|
| 59 | + New: |
| 60 | + test.rb:1:in 'Object#foo': undefined method 'time' for an instance of Integer |
| 61 | + from test.rb:2:in `<main>' |
| 62 | + ``` |
| 63 | + |
| 64 | + |
| 65 | +## C API updates |
| 66 | + |
| 67 | +* `rb_newobj` and `rb_newobj_of` (and corresponding macros `RB_NEWOBJ`, `RB_NEWOBJ_OF`, `NEWOBJ`, `NEWOBJ_OF`) have been removed. [[Feature #20265]] |
| 68 | +* Removed deprecated function `rb_gc_force_recycle`. [[Feature #18290]] |
| 69 | + |
| 70 | +## Implementation improvements |
| 71 | + |
| 72 | +* `Array#each` is rewritten in Ruby for better performance [[Feature #20182]]. |
| 73 | + |
| 74 | +## Miscellaneous changes |
| 75 | + |
| 76 | +* Passing a block to a method which doesn't use the passed block will show |
| 77 | + a warning on verbose mode (`-w`). |
| 78 | + [[Feature #15554]] |
| 79 | + |
| 80 | +* Redefining some core methods that are specially optimized by the interpeter |
| 81 | + and JIT like `String.freeze` or `Integer#+` now emits a performance class |
| 82 | + warning (`-W:performance` or `Warning[:performance] = true`). |
| 83 | + [[Feature #20429]] |
| 84 | + |
| 85 | +See GitHub releases like [Logger](https://github.com/ruby/logger/releases) or |
| 86 | +changelog for details of the default gems or bundled gems. |
| 87 | + |
| 88 | +See [NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md) |
| 89 | +or [commit logs](https://github.com/ruby/ruby/compare/v3_3_0...{{ release.tag }}) |
| 90 | +for more details. |
| 91 | + |
| 92 | +With those changes, [{{ release.stats.files_changed }} files changed, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} deletions(-)](https://github.com/ruby/ruby/compare/v3_3_0...{{ release.tag }}#file_bucket) |
| 93 | +since Ruby 3.3.0! |
| 94 | + |
| 95 | + |
| 96 | +## Download |
| 97 | + |
| 98 | +* <{{ release.url.gz }}> |
| 99 | + |
| 100 | + SIZE: {{ release.size.gz }} |
| 101 | + SHA1: {{ release.sha1.gz }} |
| 102 | + SHA256: {{ release.sha256.gz }} |
| 103 | + SHA512: {{ release.sha512.gz }} |
| 104 | + |
| 105 | +* <{{ release.url.xz }}> |
| 106 | + |
| 107 | + SIZE: {{ release.size.xz }} |
| 108 | + SHA1: {{ release.sha1.xz }} |
| 109 | + SHA256: {{ release.sha256.xz }} |
| 110 | + SHA512: {{ release.sha512.xz }} |
| 111 | + |
| 112 | +* <{{ release.url.zip }}> |
| 113 | + |
| 114 | + SIZE: {{ release.size.zip }} |
| 115 | + SHA1: {{ release.sha1.zip }} |
| 116 | + SHA256: {{ release.sha256.zip }} |
| 117 | + SHA512: {{ release.sha512.zip }} |
| 118 | + |
| 119 | +## What is Ruby |
| 120 | + |
| 121 | +Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993, |
| 122 | +and is now developed as Open Source. It runs on multiple platforms |
| 123 | +and is used all over the world especially for web development. |
| 124 | + |
| 125 | +[Feature #13557]: https://bugs.ruby-lang.org/issues/13557 |
| 126 | +[Feature #15554]: https://bugs.ruby-lang.org/issues/15554 |
| 127 | +[Feature #16495]: https://bugs.ruby-lang.org/issues/16495 |
| 128 | +[Feature #18290]: https://bugs.ruby-lang.org/issues/18290 |
| 129 | +[Feature #18980]: https://bugs.ruby-lang.org/issues/18980 |
| 130 | +[Misc #18984]: https://bugs.ruby-lang.org/issues/18984 |
| 131 | +[Feature #19117]: https://bugs.ruby-lang.org/issues/19117 |
| 132 | +[Bug #19918]: https://bugs.ruby-lang.org/issues/19918 |
| 133 | +[Bug #20064]: https://bugs.ruby-lang.org/issues/20064 |
| 134 | +[Feature #20182]: https://bugs.ruby-lang.org/issues/20182 |
| 135 | +[Feature #20205]: https://bugs.ruby-lang.org/issues/20205 |
| 136 | +[Bug #20218]: https://bugs.ruby-lang.org/issues/20218 |
| 137 | +[Feature #20265]: https://bugs.ruby-lang.org/issues/20265 |
| 138 | +[Feature #20429]: https://bugs.ruby-lang.org/issues/20429 |
0 commit comments