Prior to this e-mail, it wasn't clear to me that there were two
different "unowned" concepts.

+1 in favor of the rename.

--Emanuel

On Tue, Dec 29, 2015 at 3:18 PM, Michael Gottesman via swift-dev
<swift-dev@swift.org> wrote:
> One form of overloading that we currently have at the SIL level are the 
> notions of the "unowned" calling convention and "unowned" the variable 
> ownership convention.
>
> For those who are unfamiliar with the unowned calling convention consider the 
> following:
>
> @tmp : $@convention(thin) (@owned Array<Double>, Array<Double>, Int, Int) -> 
> Array<Double>
>
> In this case the first parameter is passed in @owned (i.e. +1) and the second 
> parameter is passed in as "unowned". Unowned is a form of +0 parameter 
> passing that essentially means that the callee needs to take ownership of the 
> value (ideally) before performing any side-effect having operations.
>
> Overloading the term "unowned" in this way is confusing for new people at the 
> SIL level. I would like to propose that we rename the unowned calling 
> convention to something else (since unowned the variable ownership convention 
> corresponds to a swift level concept that will be more difficult to change). 
> Additionally no matter what we do, we should annotate "unowned" parameters 
> and return values with an appropriate @"..." sigil to make it absolutely 
> clear visually what the convention is.
>
> In terms of names, I am partial to the name "immediate". My reasoning for 
> using the term immediate is related to SGFContext in SILGen. In SILGen, there 
> are three types of desired transfers defined by the DesiredTransfer enum.
>
>   enum DesiredTransfer {
>     PlusOne,
>     ImmediatePlusZero,
>     GuaranteedPlusZero,
>   };
>
> PlusOne refers to @owned, GuaranteedPlusZero refers to @guaranteed, and if my 
> memory is correct, ImmediatePlusZero refers to unowned. It seems natural to 
> me to choose immediate for the name of the convention to match the 
> terminology in SGFContext.
>
> Comments, flames, etc?
>
> Michael
> _______________________________________________
> swift-dev mailing list
> swift-dev@swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to