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
***Documentation:** <aclass="ruby-doc"href="https://ruby-doc.org/core-2.6/String.html#method-i-start_with-3F"><code>String#start_with?</code></a> (introduced in 2.5, but documented in 2.6)
320
+
***Note:** While looking a symmetric method, `#end_with?` does **not** support regexp; the possibility was discussed in the feature proposal and it was general agreement that the behavior should be symmetric, but eventually the implementation turned out to be too hard.
320
321
321
322
#### `String#-@` optimized for memory preserving[](#string--optimized-for-memory-preserving)
Copy file name to clipboardExpand all lines: 2.6.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,9 @@ next: 2.5
7
7
# Ruby 2.6
8
8
9
9
***Released at:** Dec 25, 2018 (<aclass="github"href="https://github.com/ruby/ruby/blob/ruby_2_6/NEWS">NEWS</a> file)
10
-
***Status (as of Jan 11, 2022):** Security maintenance, latest is 2.6.9
10
+
***Status (as of Jul 09, 2022):** Security maintenance, latest is 2.6.9
11
11
***This document first published:** Dec 29, 2018
12
-
***Last change to this document:**Jan 11, 2022
12
+
***Last change to this document:**Jul 09, 2022
13
13
14
14
> **Note:** As already explained in [Introduction](README.md), this site is dedicated to changes in the **language**, not the **implementation**, therefore the list below lacks mentions of lots of important optimization introduced in 2.6, including the whole JIT big thing. That's not because they are not important, just because this site's goals are different.
15
15
@@ -211,12 +211,13 @@ The concept of a "timezone object" is introduced for various `Time` methods. Rub
211
211
***Reason:** Named timezones are more complicated than just "offset from UTC". Going over DST date, or between different years in country history, time could have the same timezone, but different UTC offset.
Copy file name to clipboardExpand all lines: 3.0.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,9 @@ next: 2.7
7
7
# Ruby 3.0
8
8
9
9
***Released at:** Dec 25, 2020 (<aclass="github"href="https://github.com/ruby/ruby/blob/ruby_3_0/NEWS.md">NEWS.md</a> file)
10
-
***Status (as of Jan 11, 2022):** 3.0.3 is current _stable_
10
+
***Status (as of Jun 19, 2022):** 3.0.3 is current _stable_
11
11
***This document first published:** Dec 25, 2020
12
-
***Last change to this document:**Jan 11, 2022
12
+
***Last change to this document:**Jun 19, 2022
13
13
14
14
## Highlights[](#highlights)
15
15
@@ -80,7 +80,7 @@ Just a leftover from the separation of keyword arguments.
80
80
81
81
***Reason:** Argument forwarding, when [introduced in 2.7](2.7.html#keyword-argument-related-changes), was able to forward only all-or-nothing. It turned out to be not enough. One of the important usages for leading arguments are cases like `method_missing` and other DSL-defined methods that need to pass to the nested method `:some_symbol` + all of the original arguments.
***Documentation:** <aclass="ruby-doc"href="https://docs.ruby-lang.org/en/master/doc/syntax/methods_rdoc.html#label-Argument+forwarding"><code>doc/syntax/methods.rdoc</code></a> _<small>(the link is to a `master` version, docs were merged post 3.0 release)</small>_
83
+
***Documentation:** <aclass="ruby-doc"href="https://docs.ruby-lang.org/en/master/syntax/methods_rdoc.html#label-Argument+forwarding"><code>doc/syntax/methods.rdoc</code></a> _<small>(the link is to a `master` version, docs were merged post 3.0 release)</small>_
84
84
***Code:**
85
85
```ruby
86
86
defrequest(method, url, headers: {})
@@ -144,7 +144,7 @@ Methods of exactly one statement now can be defined with syntax `def method() =
***Documentation:**<a class="ruby-doc" href="https://docs.ruby-lang.org/en/master/doc/syntax/methods_rdoc.html"><code>doc/syntax/methods.rdoc</code></a>_<small>(the link is to a `master` version, docs were merged post 3.0 release)</small>_
147
+
***Documentation:**<a class="ruby-doc" href="https://docs.ruby-lang.org/en/master/syntax/methods_rdoc.html"><code>doc/syntax/methods.rdoc</code></a>_<small>(the link is to a `master` version, docs were merged post 3.0 release)</small>_
148
148
***Code:**
149
149
```ruby
150
150
def dbg = puts("DBG: #{caller.first}")
@@ -224,7 +224,7 @@ Methods of exactly one statement now can be defined with syntax `def method() =
224
224
225
225
***Reason:** This is an interesting one. Two facts were discussed between 2.7 and 3.0: the fact that in most of the other languages one-line pattern matching has a different order (`<pattern> <operator> <data>`) than introduced in Ruby 2.7 (`<data> in <pattern>`); and the idea of "rightward assignment operator" `=>` for more natural chaining. And then, at some point, ideas converged most fruitfully.
226
226
***Discussion:** <aclass="tracker feature"href="https://bugs.ruby-lang.org/issues/17260">Feature #17260</a> (main pattern matching tracking ticket), <aclass="tracker feature"href="https://bugs.ruby-lang.org/issues/16670">Feature #16670</a> (reverse order), <aclass="tracker feature"href="https://bugs.ruby-lang.org/issues/15921">Feature #15921</a> (standalone rightward assignment operator), <aclass="tracker feature"href="https://bugs.ruby-lang.org/issues/15799">Feature #15799</a> (abandoned "pipeline operator" idea, in discussion of which "rightward assignment" was born)
@@ -269,7 +269,7 @@ After the change described above, `in` was reintroduced to return `true`/`false`
269
269
270
270
***Reason:**Thenew meaning allows pattern matching to be more tightly integrated with other constructs in the control flow, like iteration and regular conditions.
@@ -741,7 +741,7 @@ The "reverse" order of the backtrace (call stack printed starting from the outer
741
741
742
742
* **Reason:** The idea of `frozen-string-literal` pragma is to avoid unnecessary allocations, when the same `"string"` repeated in the code called multiple times; but if the string is constructed dynamically with interpolation, there would be no point (it is hard to predict that allocations would be avoided, as the string can be different each time); it also breaks the "intuitive" feeling that the string is dynamic.
Copy file name to clipboardExpand all lines: 3.1.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,9 @@ next: 3.0
7
7
# Ruby 3.1
8
8
9
9
***Released at:** Dec 25, 2021 (<aclass="github"href="https://github.com/ruby/ruby/blob/ruby_3_1/NEWS.md">NEWS.md</a> file)
10
-
***Status (as of Jan 11, 2022):** 3.1.0 is current _stable_
10
+
***Status (as of Jun 19, 2022):** 3.1.0 is current _stable_
11
11
***This document first published:** Jan 5, 2022
12
-
***Last change to this document:**Jan 11, 2022
12
+
***Last change to this document:**Jun 19, 2022
13
13
14
14
> **Note:** As already explained in [Introduction](README.md), this site is dedicated to changes in the **language**, not the **implementation**, therefore the list below lacks mentions of lots of important optimization introduced in 3.1, including a new JIT named YJIT. That's not because they are not important, just because this site's goals are different.
15
15
@@ -34,7 +34,7 @@ In hash literals and method calls, `x:` is now a shortcut for `x: x`—take hash
@@ -93,7 +93,7 @@ In hash literals and method calls, `x:` is now a shortcut for `x: x`—take hash
93
93
94
94
***Reason:** When endless methods were introduced in 3.0, this syntax (named "command syntax" internally) wasn't allowed; but it was not a deliberate decision, and rather a side-effect of a parser complexity. During development of 3.1, the workaround was found to make code more consistent and refactoring from multi-line to single-line methods easier.
***Documentation:** — (<aclass="ruby-doc"href="https://docs.ruby-lang.org/en/3.1/doc/syntax/methods_rdoc.html"><code>doc/syntax/methods.rdoc</code></a> doesn't mention new or old behavior.)
96
+
***Documentation:** — (<aclass="ruby-doc"href="https://docs.ruby-lang.org/en/3.1/syntax/methods_rdoc.html"><code>doc/syntax/methods.rdoc</code></a> doesn't mention new or old behavior.)
97
97
***Code:**
98
98
```ruby
99
99
deflog(msg) =puts"#{Time.now}: #{msg}"
@@ -107,7 +107,7 @@ If method uses its block argument only to pass to another method, it can be mark
107
107
108
108
* **Reason:** The initial proposal for the feature is 6-year old and focused on avoiding intermediate blocks object allocation on block forwarding. It was considered redundant when block forwarding was optimized in Ruby 2.5; but then the core team decided it is actually a nice and unambiguous shortcut for methods that just pass the block further. As bloc argument is frequently called just `block`, the absence of the name doesn't affect readability.
@@ -151,7 +151,7 @@ If method uses its block argument only to pass to another method, it can be mark
151
151
On the initial implementation of the pattern matching, the only patterns that could've been used in matching expression were constants, literals and pinned local variables. Since 3.1, any kind of statement can be a pattern, with extended functionality of the `^` pin operator.
@@ -1195,7 +1195,7 @@ Since being added [in 2.6](2.6.html#rubyvmresolve_feature_path) (then named `Rub
1195
1195
1196
1196
***Reason:** It was argued that raising `LoadError` makes method looks like it has a side effect instead of just being a query method, and makes it inconvenient to use.
0 commit comments