Re:On the proliferation of try, and soon, await (2020)
by dcow on Thursday August 26, 2021 @03:17PM
(#28319311)
I believe if you read far enough in the thread you’ll see Swift’s “Structured Concurrency” proposal does the same thing. In Go you must `go ...` to invoke concurrency. In Swift that would be `async let = ...` under the proposal (which has already been implemented) on main. `async` just says this function returns a “future” and `await` just desugars the future. I prefer Rust’s approach where the future is an actual type, but there’s a nice element to swift’s where it is prt of the syntax, as is similar with swift’s optionals.
[ Parent
| on HN ]
Re:On the proliferation of try, and soon, await (2020)
by tomp on Friday August 27, 2021 @09:03AM
(#28327272)
Indeed, async let seems like a massive improvement! (Judging by this proposal [1].) Still the wrong default IMO (should be `let x = async ...` so that you can then do `let xs = [async f(), async g()]`) but definitely a step in the right direction.
Now just remove `async` and `throws` function annotations and/or make those default, and all noise will be removed!
[1] https://github.com/apple/swift-evolution/blob/main/proposals...