This looks fantastic. Can’t wait (heh) for async/await to land, and the Actors
pattern looks really compelling.
One thought that occurred to me reading through the section of the
"async/await" proposal on whether async implies throws:
If ‘async' implies ‘throws' and therefore ‘await' implies ‘try’, if we want to
suppress the catch block with ?/!, does that mean we do it on the ‘await’ ?
guard let foo = await? getAFoo() else { … }
This looks a little odd to me, not not extremely clear as to what is happening.
Under what conditions will we get a nil instead of a Foo? Maybe it’s just me or
that the syntax is new and I’ll get used to it.
But it gets even more complicated if we have:
func getAFoo() async -> Foo {
…
}
func getABar() async(nonthrowing) -> Bar {
…
}
Now, we have an odd situation where the ‘await’ keyword may sometimes accept
?/! but in other cases may not (or it has no meaning):
guard
let foo = await? getAFoo(),
let bar = await? getABar() // Is this an error?? If not, what does it mean?
else { … }
Since this edge of throws/try wasn’t explicitly covered in the write-up (or did
I miss it?), was wondering about your thoughts.
—Karim
> Date: Thu, 17 Aug 2017 15:24:14 -0700
> From: Chris Lattner <[email protected]>
> To: swift-evolution <[email protected]>
> Subject: [swift-evolution] [Concurrency] async/await + actors
>
> Hi all,
>
> As Ted mentioned in his email, it is great to finally kick off discussions
> for what concurrency should look like in Swift. This will surely be an epic
> multi-year journey, but it is more important to find the right design than to
> get there fast.
>
> I’ve been advocating for a specific model involving async/await and actors
> for many years now. Handwaving only goes so far, so some folks asked me to
> write them down to make the discussion more helpful and concrete. While I
> hope these ideas help push the discussion on concurrency forward, this isn’t
> in any way meant to cut off other directions: in fact I hope it helps give
> proponents of other designs a model to follow: a discussion giving extensive
> rationale, combined with the long term story arc to show that the features
> fit together.
>
> Anyway, here is the document, I hope it is useful, and I’d love to hear
> comments and suggestions for improvement:
> https://gist.github.com/lattner/31ed37682ef1576b16bca1432ea9f782
>
> -Chris
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution