[swift-evolution] /*Let it be*/ func() -> @discardable Bool {} /*Rather Than*/ @discardableResult func() -> Bool {}

David Sweeris davesweeris at mac.com
Mon Oct 9 11:14:31 CDT 2017


> On Oct 9, 2017, at 9:02 AM, Dave DeLong via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Oooo, I really like this.
> 
> It also brings up an interesting point on the whole async discussion. Doesn’t the async apply to the return value and not the other stuff?

No, the whole function including any side effects gets executed asynchronously. "Pure" functions could (sorta) be regarded as only having the "async" apply to the return value, but that mental model is incorrect and it only gives the right "answer" as a consequence of the function being pure.

At least, if I understand things correctly.

- Dave Sweeris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171009/713be5d6/attachment.html>


More information about the swift-evolution mailing list