From 1bbf180e8abc9397593be04d0d84839091b74a74 Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Wed, 25 May 2022 15:50:36 -0400 Subject: [PATCH] Add cursory release note for Regex. --- CHANGELOG.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index acb27dbd3466c..4425ab02971ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,31 @@ _**Note:** This is in reverse chronological order, so newer entries are added to ## Swift 5.7 +* [SE-0350][]: + + The standard library has a new `Regex` type. + + This type represents an _extended regular expression_, allowing more fluent + string processing operations. A `Regex` may be created by + [initialization from a string][SE-0355]: + ``` + let pattern = "a[bc]+" // matches "a" followed by one or more instances + // of either "b" or "c" + let regex = try! Regex(pattern) + ``` + Or via a [regex literal][SE-0354]: + ``` + let regex = #/a[bc]+/# + ``` + In Swift 6, `/` will also be supported as a delimiter for `Regex` literals. + You can enable this mode in Swift 5.7 with the `-enable-bare-slash-regex` + flag. Doing so will cause some existing expressions that use `/` as an + operator to no longer compile; you can add parentheses or line breaks as a + workaround. + + There are [new string-processing algorithms][SE-0357] that support + `String`, `Regex` and arbitrary `Collection` types. + * [SE-0329][]: New types representing time and clocks were introduced. This includes a protocol `Clock` defining clocks which allow for defining a concept of now and a way to wake up after a given instant. Additionally a new protocol `InstantProtocol` for defining instants in time was added. Furthermore a new protocol `DurationProtocol` was added to define an elapsed duration between two given `InstantProtocol` types. Most commonly the `Clock` types for general use are the `SuspendingClock` and `ContinuousClock` which represent the most fundamental clocks for the system. The `SuspendingClock` type does not progress while the machine is suspended whereas the `ContinuousClock` progresses no matter the state of the machine. @@ -9387,8 +9412,12 @@ Swift 1.0 [SE-0346]: [SE-0347]: [SE-0349]: +[SE-0350]: [SE-0352]: [SE-0353]: +[SE-0354]: +[SE-0355]: +[SE-0357]: [SE-0358]: [SR-75]: