[swift-evolution] [Manifesto] Ownership

John McCall rjmccall at apple.com
Mon Feb 20 12:03:51 CST 2017


> On Feb 18, 2017, at 4:18 PM, Michel Fortin via swift-evolution <swift-evolution at swift.org> wrote:
> Le 17 févr. 2017 à 3:25, John McCall via swift-evolution <swift-evolution at swift.org> a écrit :
> 
>> func endScope<T>(_ value: T) -> () {}
> 
> Just to be sure, that is the same thing as `move` where you to discard the return value, right?
> 
> 	let something = make()
> 	endScope(something)
> 
> vs.
> 
> 	let something = make()
> 	_ = move(something)

Yes, when the thing being ended is just a 'let' or 'var'.  When it's an 'inout' or 'shared', it also immediately ends the access, which isn't at all equivalent to moving a value out.

John.


More information about the swift-evolution mailing list