[Accepted] SE-0366: `consume` operator to end the lifetime of a variable binding

The second review of SE-0366: consume operator to end the lifetime of a variable binding ended on November 8th, which was followed by a joint naming revision of SE-0366/SE-0377 that ran from December 7th through December 14th. The Language Workgroup has decided to accept the proposal.

The second review of SE-0366 was generally positive, with minor constructive feedback on the restriction that a function cannot consume one of its parameters that is borrowed inside the function implementation. Reviewers argued that it’s still useful to consume such a parameter to ensure it isn’t used later in the function, and a warning would still prevent unexpected behavior. The Language Workgroup discussed this, and would like lifting the restriction to be motivated by real-world usage. The proposal is accepted with the restriction, and lifting the restriction can be revisited later after gaining practical experience with the consume operator.

The naming revision was also generally positive, and focused mostly on the parameter modifier name in SE-0377. The revision was motivated by the name take being used colloquially to describe general passing of arguments to parameters, e.g. a function takes an argument of type X. Feedback on consume for SE-0366 was positive, and the Language Workgroup decided to accept SE-0366 under the name consume.

Thank you to everyone who participated in the first pitch and proposal review! Your contributions help make Swift a better language.

Holly Borla
Review Manager

14 Likes