[swift-evolution] [Review] SE-0047 Defaulting non-Void functions so they warn on unused results

Dany St-Amant dsa.mls at icloud.com
Thu Mar 17 19:56:25 CDT 2016


> Le 16 mars 2016 à 15:36, Chris Lattner via swift-evolution <swift-evolution at swift.org> a écrit :
> 
> Hello Swift community,
> 
> The review of “Defaulting non-Void functions so they warn on unused results” begins now and runs through March 21, 2016. The proposal is available here:
> 
> 	https://github.com/apple/swift-evolution/blob/master/proposals/0047-nonvoid-warn.md
> 
> Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at:
> 	https://lists.swift.org/mailman/listinfo/swift-evolution
> 

One advantage that I see with the alternative of decorating the return type with @discardable, is that the attribute could be reused later if/when the out-only function parameters come to the language.

Something like:

func head(count: Int, tail: @discardable out String) -> String

To allow it to be safely called either as:

head = str.head(count:10, tail:&_)
head = str.head(count:10)

No need to discuss this possible usage now, just something to keep in mind when choosing the syntax.


Dany



More information about the swift-evolution mailing list