Skip to content

Revisions to SE-0366 from first round of review #1775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 25, 2022

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented Sep 9, 2022

  • 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 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.

- `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`.
@jckarter jckarter requested a review from hborla September 9, 2022 23:10
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`.
@jckarter jckarter marked this pull request as ready for review September 14, 2022 15:37
jckarter and others added 2 commits September 15, 2022 15:34
…pes.

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.
@hborla hborla merged commit bb09d19 into swiftlang:main Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants