Skip to content

Commit bb09d19

Browse files
jckarterhborla
andauthored
Revisions to SE-0366 from first round of review (#1775)
* Revisions to SE-0366 from first round of review - `move` is renamed to `take`. - Dropping a value without using it now requires an explicit `_ = take x` assignment again. - "Movable bindings" are referred to as "bindings with static lifetime", since this term is useful and relevant to other language features. - Additional "alternatives considered" raised during review and pitch discussions were added. - Expansion of "related directions" section contextualizes the `take` operator among other planned features for selective copy control. - Now that [ownership modifiers for parameters](https://forums.swift.org/t/borrow-and-take-parameter-ownership-modifiers/59581) are being pitched, this proposal ties into that one. Based on feedback during the first review, we have gone back to only allowing parameters to be used with the `take` operator if the parameter declaration is `take` or `inout`. * Change motivating example to not entangle multiple variable lifetimes As noted by @Jumhyn and others in evolution discussion, code motion optimizations could still theoretically reorder operations in a way that breaks uniqueness that relies on sequential execution to hold. Use an example that only requires forwarding ownership of a single value to demonstrate the benefit of `take`. * Add future direction discussing destructuring methods on move-only types. It would be useful to be able to destructure move-only structs, but doing so in the face of a `deinit` requires suppressing the deinit logic, since deinit needs to start from a fully-initialized value to tear down. We could provide a special operator for methods on such a type to do destructuring in limited situations where it's appropriate for their API. * Schedule SE-0366 for re-review. Co-authored-by: Holly Borla <[email protected]>
1 parent 925341d commit bb09d19

File tree

1 file changed

+498
-254
lines changed

1 file changed

+498
-254
lines changed

0 commit comments

Comments
 (0)