Hello, Swift community!
The second review of SE-0390: Noncopyable structs and enums begins now and runs through April 4, 2023.
This proposal has already been accepted in principle. We would like to keep this review narrowly focused on the two significant changes from the first proposal:
-
The new syntax for suppressing the implied copyable constraint. The authors have used
Type: ~Copyable
for this purpose. During the initial review, a few variants on this were proposed; the workgroup is willing to consider alternatives of the formxCopyable
, wherex
is a printed ASCII character available on US keyboards that doesn't obviously mean something else. Under my survey, the set of vaguely-plausibly-viable characters is~
,-
,/
,?
,^
and!
.The authors have used
~Copyable
; absent a clear case that one of the other options would be better, that is what we will use, but we are open to argument. -
The operator formerly known as
forget
is nowdiscard self
has been tightly constrained:discard self
can only be applied toself
, in a consuming method defined in the same file as the type's original definition
...
For the extent of this proposal, we also propose thatdiscard self
can only be applied in types whose components include no reference-counted, generic, or existential fields, nor do they include any types that transitively include any fields of those types or that havedeinit
s defined of their own. (Such a type might be called "POD" or "trivial" following C++ terminology). We explore lifting this restriction as a future direction.and its semantics have been more tightly specified. The LWG would especially appreciate focused attention on these details from reviewers.
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 by email or DM. When contacting the review manager directly, please keep the proposal link at the top of the message and put "SE-0364" in the subject line.
What goes into a review?
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:
https://github.com/apple/swift-evolution/blob/main/process.md
Thank you,
Steve Canon
Review Manager