> On Oct 8, 2016, at 12:39 AM, John McCall <rjmcc...@apple.com> wrote:
>
>> %a = alloc_stack
>>
>> begin_exclusive %a
>> apply foo(%a) // must be marked an initializer?
>> end_exclusive %a
>>
>> begin_shared %a
>> apply bar(%a) // immutable access
>> end_shared %a
>>
>> dealloc_stack %a
>
> I think alloc_stack returns an owned (but uninitialized) address and there's
> general scoped operation to turn an owned address into a borrow. Or it could
> be implicit in the operation that needs a borrowed value, as you suggest
> below.
I should have decorated the code with transitions to get the point across:
%a = alloc_stack // -> owned/uninitialized
begin_exclusive %a // -> exclusive/uninitialized
apply foo(%a) // -> exclusive/initialized
end_exclusive %a // -> owned/initialized
begin_shared %a // -> shared (implies initialized)
apply bar(%a) // immutable access
end_shared %a // -> owned/initialized
dealloc_stack %a // -> invalid
-Andy
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev