Skip to content

Commit b6dee34

Browse files
authored
Ruby 3.3 (#55)
1 parent 9c313c6 commit b6dee34

21 files changed

Lines changed: 2355 additions & 166 deletions

2.4.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ description: Ruby 2.4 full and annotated changelog
1616
-->
1717

1818
* **Released at:** Dec 25, 2016 (<a class="github" href="https://github.com/ruby/ruby/blob/trunk/doc/NEWS-2.4.0">NEWS</a> file)
19-
* **Status (as of Feb 04, 2023):** EOL, latest is 2.4.10
19+
* **Status (as of Dec 21, 2023):** EOL, latest is 2.4.10
2020
* **This document first published:** Oct 14, 2019
21-
* **Last change to this document:** Feb 04, 2023
21+
* **Last change to this document:** Dec 21, 2023
2222

2323
## Highlights[](#highlights)
2424

@@ -189,6 +189,7 @@ New single-method module was introduced, meant to be overridden in order to cont
189189
```
190190
* In Ruby 2.7, new methods [were added](2.7.html#warning-and-) to `Warning` module allowing control over per-category warning suppression;
191191
* In Ruby 3.0, category support [was improved](3.0.html#warningwarn-category-keyword-argument).
192+
* [3.3](3.3.html#new-warning-category-performance): added new warning category: `:performance`.
192193

193194
### `Object#clone(freeze: false)`[](#objectclonefreeze-false)
194195

2.7.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ description: Ruby 2.7 full and annotated changelog
88
# Ruby 2.7
99

1010
* **Released at:** Dec 25, 2019 (<a class="github" href="https://github.com/ruby/ruby/blob/ruby_2_7/NEWS">NEWS</a> file)
11-
* **Status (as of Sep 20, 2023):** 2.7.8 is EOL
11+
* **Status (as of Dec 21, 2023):** 2.7.8 is EOL
1212
* **This document first published:** Dec 27, 2019
13-
* **Last change to this document:** Sep 20, 2023
13+
* **Last change to this document:** Dec 21, 2023
1414

1515
<!-- TODO: all links to docs should be replaced with /2.7.0/ suffix instead of /master/ when 2.7.0 would be published -->
1616

@@ -121,7 +121,9 @@ In block without explicitly specified parameters, variables `_1` through `_9` ca
121121
# %w[test me].each { _1.each_char { p _1 } }
122122
# ^~
123123
```
124-
* **Follow-up:** Warning on attempt to assign to numbered parameter [became errors in 3.0](3.0.html#other-changes).
124+
* **Follow-ups:**
125+
* [3.0](3.0.html#other-changes): Warning on attempt to assign to numbered parameter became errors.
126+
* [3.3](3.3.html#standalone-it-in-blocks-will-become-anonymous-argument-in-ruby-34): a warning introduced indicating that in Ruby 3.4, `it` would become an alternative anonymous block parameter (only one, same as `_1`). There is no plan to deprecate numbered parameters.
125127

126128
### Beginless range[](#beginless-range)
127129

@@ -799,6 +801,7 @@ Like `Array#union` and `#difference`, [added](2.6.html#arrayunion-and-arraydiffe
799801
map[1]
800802
# => nil -- value successfully collected, even if key was not GC-able
801803
```
804+
* **Follow-ups:** [3.3](3.3.html#objectspaceweakkeymap): A new class `ObjectSpace::WeakKeyMap` introduced, more suitable for common use-cases of a "weak mapping." It only has garbage-collectable keys.
802805

803806
### `Fiber#raise`[](#fiberraise)
804807

@@ -1028,7 +1031,7 @@ Allows to emit/suppress separate categories of warnings.
10281031
```
10291032
* **Notes:**
10301033
* The only existing categories currently are `:deprecated` (covers all deprecations) and `:experimental` (as of 2.7, covers only pattern matching)
1031-
* Note that turning of `:deprecated` warning will also mute the warning of features which was deprecated explicitly in your code, for example with <a class="ruby-doc" href="https://ruby-doc.org/core-2.7.0/Module.html#method-i-deprecate_constant"><code>Module#deprecate_constant</code></a>
1034+
* Note that turning off `:deprecated` warning will also mute the warning of features which was deprecated explicitly in your code, for example with <a class="ruby-doc" href="https://ruby-doc.org/core-2.7.0/Module.html#method-i-deprecate_constant"><code>Module#deprecate_constant</code></a>
10321035
```ruby
10331036
class HTTP
10341037
NOT_FOUND = Exception.new
@@ -1041,7 +1044,9 @@ Allows to emit/suppress separate categories of warnings.
10411044
# ...no warning issued...
10421045
```
10431046
* Another way to turn on and off separate categories of warnings is passing `-W:(no-)<category>` flag to ruby interpreter, e.g. `-W:no-experimental` means "no warnings when using experimental features".
1044-
* **Follow-up:** In Ruby 3.0, it was [allowed for user code](3.0.html#warningwarn-category-keyword-argument) to specify warning category, and intercept it.
1047+
* **Follow-ups:**
1048+
* [3.0](3.0.html#warningwarn-category-keyword-argument): user code is allowed to specify warning category, and intercept it;
1049+
* [3.3](3.3.html#new-warning-category-performance): added new warning category: `:performance`.
10451050

10461051
## Standard library[](#standard-library)
10471052

3.0.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ description: Ruby 3.0 full and annotated changelog
88
# Ruby 3.0
99

1010
* **Released at:** Dec 25, 2020 (<a class="github" href="https://github.com/ruby/ruby/blob/ruby_3_0/NEWS.md">NEWS.md</a> file)
11-
* **Status (as of Sep 20, 2023):** 3.0.6 is security maintenance (will EOL soon!)
11+
* **Status (as of Dec 23, 2023):** 3.0.6 is security maintenance (will EOL soon!)
1212
* **This document first published:** Dec 25, 2020
13-
* **Last change to this document:** Sep 20, 2023
13+
* **Last change to this document:** Dec 23, 2023
1414

1515
## Highlights[](#highlights)
1616

@@ -105,6 +105,7 @@ Just a leftover from the separation of keyword arguments.
105105
logged_get('Logging', 'https://example.com', headers: {content_type: 'json'})
106106
```
107107
* **Notes:**
108+
* The adjustment was considered important enough to be backported to 2.7 branch;
108109
* "all arguments splat" `...` should be the last statement in the argument list (both on a declaration and a call)
109110
* on a method declaration, arguments before `...` can only be positional (not keyword) arguments, and can't have default values (it would be `SyntaxError`);
110111
* on a method call, arguments passed before `...` can't be keyword arguments (it would be `SyntaxError`);
@@ -960,6 +961,7 @@ Just fixes an inconsistency introduced by optimization many versions ago.
960961
processed.lambda? # => false
961962
processed.call # => "nil", it is really still not a lambda
962963
```
964+
* **Follow-ups:** [3.3](3.3.html#kernellambda-raises-when-passed-proc-instance): The warning was turned into an exception.
963965

964966
#### `Proc#==` and `#eql?`[](#proc-and-eql)
965967

3.2.md

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
title: Ruby 3.2 changes
3-
prev: /
3+
prev: 3.3
44
next: 3.1
55
description: Ruby 3.2 full and annotated changelog
66
---
77

88
# Ruby 3.2
99

1010
* **Released at:** Dec 25, 2022 (<a class="github" href="https://github.com/ruby/ruby/blob/ruby_3_2/NEWS.md">NEWS.md</a> file)
11-
* **Status (as of Sep 20, 2023):** 3.2.2 is current _stable_
11+
* **Status (as of Dec 24, 2023):** 3.2.2 is current _stable_
1212
* **This document first published:** Feb 4, 2022
13-
* **Last change to this document:** Sep 20, 2023
13+
* **Last change to this document:** Dec 24, 2023
1414

1515
<!--
1616
* **Reason:**
@@ -249,12 +249,12 @@ A few edge cases after [big keyword argument separation](3.0.html#keyword-argume
249249
### Removals[](#removals)
250250

251251
* Constants:
252-
* `Fixnum` and `Bignum` (deprecated since unification into `Integer` in [2.4](/2.4.html#fixnum-and-bignum-are-unified-into-integer))
253-
* `Random::DEFAULT` (deprecated in favor of per-Ractor random generator since [3.0](/3.0.html#randomdefault-behavior-change))
252+
* `Fixnum` and `Bignum` (deprecated since unification into `Integer` in [2.4](2.4.html#fixnum-and-bignum-are-unified-into-integer))
253+
* `Random::DEFAULT` (deprecated in favor of per-Ractor random generator since [3.0](3.0.html#randomdefault-behavior-change))
254254
* Methods:
255255
* `Dir.exists?`, `File.exists?` (deprecated since 2.1 as a general rule of having "bare verb" as a method name)
256-
* `Object#=~` (deprecated since [2.6](/2.6.html#minor-changes))
257-
* `Object#taint`, `#untaint`, `#tainted?`, `#trust`, `#untrust`, `#untrusted?` (deprecated together with a general concept of "safety" since [2.7](/2.7.html#safe-and-taint-concepts-are-deprecated-in-general))
256+
* `Object#=~` (deprecated since [2.6](2.6.html#minor-changes))
257+
* `Object#taint`, `#untaint`, `#tainted?`, `#trust`, `#untrust`, `#untrusted?` (deprecated together with a general concept of "safety" since [2.7](2.7.html#safe-and-taint-concepts-are-deprecated-in-general))
258258

259259

260260
## Core classes and modules[](#core-classes-and-modules)
@@ -504,20 +504,7 @@ Returns list of refinements the module defines.
504504
* **Discussion:** <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/12737">Feature #12737</a>
505505
* **Documentation:** <a class="ruby-doc" href="https://docs.ruby-lang.org/en/3.2/Refinement.html#method-i-refined_class"><code>Refinement#refined_class</code></a>
506506
* **Code:** See example above that demonstrates usage of `#refined_class` together with `Module#refinements`.
507-
* **Note:** The name of the method implies only classes can be refined, which is not true; modules can be refined also, and `refined_class` will promptly return them:
508-
```ruby
509-
module BetterEnum
510-
refine Enumerable do
511-
def each2(&block) = each_slice(2, &block)
512-
end
513-
end
514-
515-
BetterEnum.refinements[0].refined_class #=> Enumerable
516-
517-
using BetterEnum
518-
(1..6).each2.to_a #=> [[1, 2], [3, 4], [5, 6]]
519-
```
520-
Currently [discussed](https://bugs.ruby-lang.org/issues/19366).
507+
* **Follow-ups:** [3.3](3.3.html#refinementrefined_class-is-renamed-to-refinementtarget): Renamed to `#target`, because not only classes can be refined, modules too.
521508

522509
#### `Module.used_refinements`[](#moduleused_refinements)
523510

@@ -622,7 +609,9 @@ Several method were added that operate on multibyte strings at byte-offset level
622609
str.byteslice(1..3) #=> "\xB2і" -- works, even if the slice is mid-character
623610
str.bytesplice(1..3, '...') # offset 1 does not land on character boundary (IndexError)
624611
```
625-
* **Note:** After 3.2 release, `bytesplice` behavior [had changed](https://bugs.ruby-lang.org/issues/19314#note-8) to return `self` instead of replacement string.
612+
* **Note:**
613+
* After 3.2 release, `bytesplice` behavior [had changed](https://bugs.ruby-lang.org/issues/19314#note-8) to return `self` instead of replacement string.
614+
* [3.3](3.3.html#stringbytesplice-new-arguments-to-select-a-portion-of-the-replacement-string): parameters added to `bytesplice` to allow partial copy of the buffer.
626615
627616
#### `String#dedup` as an alias for `-"string"`[](#stringdedup-as-an-alias-for--string)
628617

@@ -753,6 +742,7 @@ The new protocol for `Time.new` is introduced, that parses Time from string.
753742
#=> 2023-01-29 00:00:00 +0200
754743
```
755744
* `Time.new('2023')` works, too, but it is a feature that worked before (force-conversion of singular year argument to integer), see <a class="tracker bug" href="https://bugs.ruby-lang.org/issues/19293">Bug #19293</a>. It will probably be deprecated, but can't be quickly removed due to backward compatibility.
745+
* **Follow-ups:**: [3.3](3.3.html#timenew-with-string-argument-became-stricter): `Time.new` became stricting, accepting only fully-specified date-time.
756746

757747
### `Struct` and `Data`[](#struct-and-data)
758748

@@ -891,7 +881,8 @@ A new class for containing value objects: it is somewhat similar to `Struct` (an
891881
res
892882
#=> #<data Result array=[4, 3, 2, 1]>
893883
```
894-
* `#with` method in Ruby 3.2 is naive and just copies all old and new attributes to the new instance, without invoking any custom initialization methods. In the next version, though, it [expected to call `#initialize`](https://bugs.ruby-lang.org/issues/19259):
884+
* **Follow-ups:**
885+
* `#with` method in Ruby 3.2.0 was naive and just copies all old and new attributes to the new instance, without invoking any custom initialization methods. It was fixed to [call `#initialize`](https://bugs.ruby-lang.org/issues/19259) in 3.2.2:
895886
```ruby
896887
Point = Data.define(:x, :y) do
897888
def initialize(x:, y:) = super(x: x.to_i, y: y.to_i)
@@ -1127,7 +1118,8 @@ Previously a part of standard library, Set (a collection of unique elements) was
11271118
t.tag #=> 'test'
11281119
t.dup.tag #=> nil
11291120
```
1130-
This is a [bug](https://bugs.ruby-lang.org/issues/19362) and will probably <a class="github" href="https://github.com/ruby/ruby/pull/7178">change</a> in Ruby 3.2.2.
1121+
This is a [bug](https://bugs.ruby-lang.org/issues/19362).
1122+
* **Follow-ups:** [3.3](3.3.html#procdup-and-clone-call-initialize_dup-and-initialize_copy): `#dup` properly invokes `#initialize_dup`.
11311123

11321124
#### `Proc#parameters`: new keyword argument `lambda: true/false`[](#procparameters-new-keyword-argument-lambda-truefalse)
11331125

@@ -1162,7 +1154,7 @@ Previously a part of standard library, Set (a collection of unique elements) was
11621154
11631155
#### `Method#public?`, `#protected?`, and `#private?` are removed[](#methodpublic-protected-and-private-are-removed)
11641156
1165-
Predicates to check method visibility added in Ruby 3.1 were reverted.
1157+
Predicates to check method visibility [added in Ruby 3.1](3.1.html#methodunboundmethod-public-private-protected) were reverted.
11661158
11671159
* **Reason:** The new feature implementation have led to several bugs with `Method` class behavior; while investigating the root cause for those bugs, Matz have decided that method's visibility is not its inherent property, but rather a property of the module/object that owns the method, and as such, is already present in form of `Module#{private,public,protected}_instance_methods` and `Object#{private,public,protected}_methods`
11681160
* **Discussion:** <a class="tracker feature" href="https://bugs.ruby-lang.org/issues/11689#note-24#note-24">Feature #11689<small>#note-24</small></a>
@@ -1778,7 +1770,7 @@ A few changes to mention, though:
17781770
* <a class="github" href="https://github.com/ruby/net-http">net-http</a> 0.3.2
17791771
* <a class="github" href="https://github.com/ruby/net-protocol">net-protocol</a> 0.2.1
17801772
* <a class="github" href="https://github.com/ruby/nkf">nkf</a> 0.1.2
1781-
* <a class="github" href="https://github.com/ruby/open">open</a>-uri 0.3.0
1773+
* <a class="github" href="https://github.com/ruby/open-uri">open-uri</a> 0.3.0
17821774
* <a class="github" href="https://github.com/ruby/open3">open3</a> 0.1.2
17831775
* <a class="github" href="https://github.com/ruby/openssl">openssl</a> 3.1.0
17841776
* <a class="github" href="https://github.com/ruby/optparse">optparse</a> 0.3.1
@@ -1812,7 +1804,7 @@ A few changes to mention, though:
18121804

18131805
#### Bundled gems[](#bundled-gems)
18141806

1815-
* <a class="github" href="https://github.com/ruby/minitest">minitest</a> 5.16.3
1807+
* <a class="github" href="https://github.com/minitest/minitest">minitest</a> 5.16.3
18161808
* <a class="github" href="https://github.com/ruby/power_assert">power_assert</a> 2.0.3
18171809
* <a class="github" href="https://github.com/ruby/test-unit">test-unit</a> 3.5.7
18181810
* <a class="github" href="https://github.com/ruby/net-ftp">net-ftp</a> 0.2.0
@@ -1825,6 +1817,8 @@ A few changes to mention, though:
18251817

18261818
### Standard library content changes[](#standard-library-content-changes)
18271819

1820+
#### New libraries[](#new-libraries)
1821+
18281822
* <a class="github" href="https://github.com/ruby/syntax_suggest">syntax_suggest</a> (formerly `dead_end`) gem added. It provides helpful error messages for wrong syntax, trying to guess the place of the error. For example, assuming this `test.rb`:
18291823
```ruby
18301824
def foo

0 commit comments

Comments
 (0)