# SE-0366 (second review): \`take\` operator to end the lifetime of a variable binding

**URL:** <https://forums.swift.org/t/se-0366-second-review-take-operator-to-end-the-lifetime-of-a-variable-binding/61021>\
**Category:** Proposal Reviews\
**Tags:** ownership, performance, arc\
**Created:** [October 25, 2022, 5:48pm UTC](https://forums.swift.org/t/se-0366-second-review-take-operator-to-end-the-lifetime-of-a-variable-binding/61021 "2022-10-25T17:48:07Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![Karl](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@Karl](https://forums.swift.org/u/Karl)\
**Post date:** [October 31, 2022, 6:46pm UTC](https://forums.swift.org/t/se-0366-second-review-take-operator-to-end-the-lifetime-of-a-variable-binding/61021/21 "2022-10-31T18:46:50Z")

</div>

It also seems strange because I can pass a `borrow` function parameter to another function which accepts its parameter by `take` (because the compiler will insert an implicit copy), but I can't actually perform a `take` manually.

```swift
func someFunction<T>(_ x: /* implicit: borrow */ T) {

  takesArg(x) // ok, compiler inserts a copy

  let _ = take x // error: 'x' is not 'take'
}

func takesArg<T>(_ x: take T) {

  let _ = take x // ok...
}

```

I wonder if that's going to feel confusing to people.

---

<div class="post-metadata">

**Author:** ![jrose](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jrose/32/408_2.png) [@jrose](https://forums.swift.org/u/jrose)\
**Post date:** [November 7, 2022, 2:23am UTC](https://forums.swift.org/t/se-0366-second-review-take-operator-to-end-the-lifetime-of-a-variable-binding/61021/22 "2022-11-07T02:23:31Z")

</div>

Would it be better to make this a warning rather than an error? It has no semantic effect at run time, and (if the compiler takes it literally as “produce an owned value”) a negative performance effect, but it doesn’t otherwise make the program invalid. That would be in line with similar warnings like “cast always succeeds”.

(The `take` operator _does_ have a compile-time effect, that of ending the lifetime of the original _name,_ but I agree it’s better not to allow that if it _doesn’t_ come with the run-time effect of releasing the value.)

---

<div class="post-metadata">

**Author:** ![hborla](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hborla/32/27563_2.png) [@hborla](https://forums.swift.org/u/hborla)\
**Post date:** [December 7, 2022, 9:24pm UTC](https://forums.swift.org/t/se-0366-second-review-take-operator-to-end-the-lifetime-of-a-variable-binding/61021/23 "2022-12-07T21:24:44Z")

</div>

> [@jrose](#):
>
> Would it be better to make this a warning rather than an error?

I'll provide a complete summary of the review outcome with the acceptance, but since this is right at the top: the Language Workgroup discussed this and we decided that we'd like more real-world experience with `take`/`consume` before considering downgrading this restriction. It's easy to remove restrictions later. It's not easy to add back a restriction later if we find that only producing a warning is harmful or confusing in practice.

---

<div class="post-metadata">

**Author:** ![hborla](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hborla/32/27563_2.png) [@hborla](https://forums.swift.org/u/hborla)\
**Post date:** [December 7, 2022, 9:24pm UTC](https://forums.swift.org/t/se-0366-second-review-take-operator-to-end-the-lifetime-of-a-variable-binding/61021/24 "2022-12-07T21:24:54Z")

</div>

Thanks everyone for your feedback so far! I've kicked off another re-review of SE-0366 here:

> [@Combined SE-0366 (third review) and SE-0377 (second review): rename \`take\`/\`taking\` to \`consume\`/\`consuming\`](https://forums.swift.org/t/combined-se-0366-third-review-and-se-0377-second-review-rename-take-taking-to-consume-consuming/61904):
>
> Hello, Swift community! The combined third review of [SE-0366: consume operator to end the lifetime of a variable binding](https://github.com/apple/swift-evolution/blob/main/proposals/0366-move-function.md) and second review of [SE-0377: borrow and consume parameter ownership modifiers](https://github.com/apple/swift-evolution/blob/main/proposals/0377-parameter-ownership-modifiers.md) begins now and run through December 14th, 2022. Throughout the reviews for SE-0366 and SE-0377, reviewers surfaced the concern that ‘take’ is too general a name to describe ownership transfer; ‘take’ is used colloquially to describe general passing of arguments to parameters, e.g. a function takes…

Please provide further feedback on the new review thread. Thank you!

Holly Borla  
Review Manager

---

<div class="post-metadata">

**Author:** ![John\_McCall](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/john_mccall/32/1351_2.png) [@John\_McCall](https://forums.swift.org/u/John_McCall)\
**Post date:** [December 7, 2022, 9:29pm UTC](https://forums.swift.org/t/se-0366-second-review-take-operator-to-end-the-lifetime-of-a-variable-binding/61021/25 "2022-12-07T21:29:45Z")

</div>

Closed on December 7, 2022, 9:29pm UTC



[Previous page](https://forums.swift.org/t/se-0366-second-review-take-operator-to-end-the-lifetime-of-a-variable-binding/61021.md?page=1)
