[swift-evolution] Make non-void functions @warn_unused_result by default

Erica Sadun erica at ericasadun.com
Thu Feb 25 08:37:55 CST 2016


I like this a lot.

-- E

> On Feb 25, 2016, at 1:13 AM, Nicola Salmoria via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I agree that the attribute should be attached to the return type instead that to the function.
> 
> I’d say that the cases where it’s ok to discard the result are when the result is not strictly part of the API, but provided because it could be useful to the caller. An attribute that would naturally describe this could be
> 
> @convenience
> 
> The first example that comes to mind is Dictionary.updateValue. The declaration could then become
> 
>     public mutating func updateValue(value: Value, forKey key: Key) -> @convenience Value?
> 
> Nicola

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160225/979855e7/attachment.html>


More information about the swift-evolution mailing list