Hello, Swift community.
The second review of SE-0354: Regex Literals begins now and runs through May 23, 2022.
The core team has decided to run a second review while accepting in principle the need for a regex literal and the use of
/.../ as the delimiter.
The majority of discussion in the first review was regarding the choice of delimiter, and its impact on existing source – specifically due to removal of prefix
/ operators. During the review discussion, an alternative parsing rule was established that eliminated the need to remove these operators.
The additions to the proposal consists of two parts:
- looking forward for unmatched closing parentheses within the regular expression, and only parsing the
/as a regex if there are none. This resolves ambiguity such as
f(x, /, y).reduce(/)
/as an operator if there is no second
/on the same line
Testing by the proposal authors indicate that several open-source packages that used those operators now compile cleanly with the 5.7 release branch.
Given this, the core team has decided to open a second round of review, with the new parsing rule, for further feedback. In particular, the core team would like this review to focus on other aspects of the proposal, such as multi-line non-semantic whitespace literals, and the typed capture behavior. Feedback on any unanticipated edge cases with the new parsing rule would also be appreciated.
This review is part of a collection of proposals for better string processing in Swift. The proposal authors have put together a proposal overview with links to in-progress pitches and reviews. This proposal introduces a literal syntax for the
Regex to the language. It will be run simultaneously with a proposal regarding the syntax for constructing that type from a
String or literal .
As with the concurrency initiative last year, the core team acknowledges that reviewing a large number of interlinked proposals can be challenging. In particular, acceptance of one of the proposals should be considered provisional on future discussions of follow-on proposals that are closely related but have not yet completed the evolution review process. Similarly, reviewers should hold back on in-depth discussion of a subject of an upcoming review. Please do your best to review each proposal on its own merits, while still understanding its relationship to the larger feature.
Reviews are an important part of the Swift evolution process. All review feedback should be either on this forum thread or, if you would like to keep your feedback private, directly to the review manager. If you do email me directly, please put "SE-0354" somewhere in the subject line.
The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:
- What is your evaluation of the proposal?
- Is the problem being addressed significant enough to warrant a change to Swift?
- Does this proposal fit well with the feel and direction of Swift?
- If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
- How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
More information about the Swift evolution process is available at:
As always, thank you for contributing to Swift.