You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***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 nottrue; modules can be refined also, and`refined_class` will promptly returnthem:
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.
@@ -622,7 +609,9 @@ Several method were added that operate on multibyte strings at byte-offset level
622
609
str.byteslice(1..3) #=> "\xB2і" -- works, even if the slice is mid-character
623
610
str.bytesplice(1..3, '...') # offset 1 does not land on character boundary (IndexError)
624
611
```
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.
626
615
627
616
#### `String#dedup` as an alias for `-"string"`[](#stringdedup-as-an-alias-for--string)
628
617
@@ -753,6 +742,7 @@ The new protocol for `Time.new` is introduced, that parses Time from string.
753
742
#=> 2023-01-29 00:00:00 +0200
754
743
```
755
744
*`Time.new('2023')` works, too, but it is a feature that worked before (force-conversion of singular year argument to integer), see <aclass="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.
756
746
757
747
### `Struct` and `Data`[](#struct-and-data)
758
748
@@ -891,7 +881,8 @@ A new class for containing value objects: it is somewhat similar to `Struct` (an
891
881
res
892
882
#=> #<data Result array=[4, 3, 2, 1]>
893
883
```
894
-
*`#with` method inRuby3.2 is naive and just copies all old andnew 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 inRuby3.2.0 was naive and just copies all old andnew attributes to the new instance, without invoking any custom initialization methods. It was fixed to [call `#initialize`](https://bugs.ruby-lang.org/issues/19259) in3.2.2:
#### `Proc#parameters`: new keyword argument `lambda: true/false`[](#procparameters-new-keyword-argument-lambda-truefalse)
1134
1125
@@ -1163,7 +1154,7 @@ Previously a part of standard library, Set (a collection of unique elements) was
1163
1154
1164
1155
#### `Method#public?`, `#protected?`, and `#private?` are removed[](#methodpublic-protected-and-private-are-removed)
1165
1156
1166
-
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.
1167
1158
1168
1159
* **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`
Copy file name to clipboardExpand all lines: 3.3.md
+69-22Lines changed: 69 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,9 @@ description: Ruby 3.3 full and annotated changelog
8
8
# Ruby 3.3
9
9
10
10
***Released at:** Dec 25, 2023 ([NEWS.md](TODO) file)
11
-
***Status (as of Dec 19, 2023):** TODO
11
+
***Status (as of Dec 20, 2023):** TODO
12
12
***This document first published:** Dec 25, 2023
13
-
***Last change to this document:** Dec 19, 2023
13
+
***Last change to this document:** Dec 20, 2023
14
14
15
15
<!--
16
16
* **Reason:**
@@ -24,11 +24,11 @@ description: Ruby 3.3 full and annotated changelog
24
24
25
25
> 3.3 has many important _internal_ changes related to performance optimizations, parser, and JIT (which are mostly of scope of what I am able and willing to cover), but somewhat lighter on the "small quality of life improvement" side.
26
26
27
-
*[`it` will become anonymous block argument in 3.4]()
28
-
*[`Module#set_temporary_name`]()
29
-
*[`ObjectSpace::WeakKeyMap`]()
30
-
*[`Range#overlap?`]()
31
-
*[`Fiber#kill`]()
27
+
*[`it` will become anonymous block argument in 3.4](#standalone-it-in-blocks-will-become-anonymous-argument-in-ruby-34)
@@ -295,6 +295,32 @@ The low-level string manipulation method now allows to provide a coordinates of
295
295
```
296
296
***Notes:** While `symbolize_names:` might looks somewhat strange (usually we talk about hash _keys_), it is done for consistency with Ruby standard library's <aclass="ruby-doc"href="https://docs.ruby-lang.org/en/master/JSON.html#module-JSON-label-Output+Options"><code>`JSON.parse`</code></a> signature, which inherited the terminology from the JSON specification.
297
297
298
+
### `Time.new` with string argument became stricter[](#timenew-with-string-argument-became-stricter)
299
+
300
+
The method now requires fully-specified date-time string.
# Ruby 3.3: in `initialize': no time information (ArgumentError)
309
+
310
+
Time.new('2023-12')
311
+
# Ruby 3.2: #=> 2023-12-01 00:00:00 +0200
312
+
# Ruby 3.3: in `initialize': no time information (ArgumentError)
313
+
314
+
# Singular year is still works:
315
+
Time.new('2023')
316
+
#=> 2023-01-01 00:00:00 +0200
317
+
318
+
# ...because it is documented behavior of Time.new to accept
319
+
# strings that are numeric and treat them as numbers:
320
+
Time.new('2023', '12', '20')
321
+
#=> 2023-12-20 00:00:00 +0200
322
+
```
323
+
298
324
### `Array#pack` and `String#unpack`: raise `ArgumentError` for unknown directives[](#arraypack-and-stringunpack-raise-argumenterror-for-unknown-directives)
299
325
300
326
***Discussion:**[Bug #19150]
@@ -519,7 +545,7 @@ Two methods to accept an integer file descriptor as an argument: `for_fd` create
519
545
```
520
546
***Notes:**
521
547
* The functionality is only supported on POSIX platforms;
522
-
* The initial [ticket](https://bugs.ruby-lang.org/issues/19347) only proposed to find a way to be able to change a current directory to one specified by a descriptor (i.e., what eventually became `.fchdir`), but during the discussion a need were discovered for a generic instantiation of a `Dir` instance from the descriptor (what became `from_fd`), as well as a generic way to change the current directory to one specified by `Dir` instance ([`#chdir`](TODO), which is not related to descriptors but is generically useful).
548
+
* The initial [ticket](https://bugs.ruby-lang.org/issues/19347) only proposed to find a way to be able to change a current directory to one specified by a descriptor (i.e., what eventually became `.fchdir`), but during the discussion a need were discovered for a generic instantiation of a `Dir` instance from the descriptor (what became `from_fd`), as well as a generic way to change the current directory to one specified by `Dir` instance ([`#chdir`](#dirchdir), which is not related to descriptors but is generically useful).
523
549
524
550
#### `Dir#chdir`[](#dirchdir)
525
551
@@ -574,6 +600,27 @@ An instance method version of <a class="ruby-doc" href="https://docs.ruby-lang.o
574
600
```
575
601
*As the impact of the change might be big, note that target version for removal is set to **4.0**. To the best of my knowledge, there are no set date for major version yet.
576
602
603
+
### `NoMethodError`: change of rendering logic[](#nomethoderror-change-of-rendering-logic)
604
+
605
+
`NoMethodError` doesn't use target object's `#inspect`in its message, and renders "instance of ClassName" instead.
606
+
607
+
***Reason:**While the `#inspect` of the object which failed to respond might be convenient in the error's output, it also might be extremely inefficient and confusing when the object is large and doesn't have `#inspect` redefined to something sensible. It is impossible to require all user objects to redefine `#inspect`, and even if it is redefined, it might be short yet inefficient; so the lesser of evils was chosen and exception's message became more efficient even if less informative.
#### Gems that are warned to become bundled in the next version[](#gems-that-are-warned-to-become-bundled-in-the-next-version)
875
922
876
923
These gems wouldn't in a Bundler-managed environment unless explicitly added to `Gemfile` since the next version of Ruby. For now, requiring them in such environment would produce a warning. Discussion: [Feature #19351] (initial proposal to promote many gems, which then was deemed problematic), [Feature #19776] (the warning proposal)
***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 nottrue; modules can be refined also, and`refined_class` will promptly returnthem:
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.
521
508
522
509
#### `Module.used_refinements`
523
510
@@ -622,7 +609,9 @@ Several method were added that operate on multibyte strings at byte-offset level
622
609
str.byteslice(1..3) #=> "\xB2і" -- works, even if the slice is mid-character
623
610
str.bytesplice(1..3, '...') # offset 1 does not land on character boundary (IndexError)
624
611
```
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.
626
615
627
616
#### `String#dedup` as an alias for `-"string"`
628
617
@@ -753,6 +742,7 @@ The new protocol for `Time.new` is introduced, that parses Time from string.
753
742
#=> 2023-01-29 00:00:00 +0200
754
743
```
755
744
*`Time.new('2023')` works, too, but it is a feature that worked before (force-conversion of singular year argument to integer), see [Bug #19293](https://bugs.ruby-lang.org/issues/19293). 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.
756
746
757
747
### `Struct` and `Data`
758
748
@@ -891,7 +881,8 @@ A new class for containing value objects: it is somewhat similar to `Struct` (an
891
881
res
892
882
#=> #<data Result array=[4, 3, 2, 1]>
893
883
```
894
-
*`#with` method inRuby3.2 is naive and just copies all old andnew 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 inRuby3.2.0 was naive and just copies all old andnew attributes to the new instance, without invoking any custom initialization methods. It was fixed to [call `#initialize`](https://bugs.ruby-lang.org/issues/19259) in3.2.2:
#### `Proc#parameters`: new keyword argument `lambda: true/false`
1134
1125
@@ -1163,7 +1154,7 @@ Previously a part of standard library, Set (a collection of unique elements) was
1163
1154
1164
1155
#### `Method#public?`, `#protected?`, and `#private?` are removed
1165
1156
1166
-
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.
1167
1158
1168
1159
* **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`
0 commit comments