> On Aug 19, 2017, at 3:23 AM, Georgios Moschovitis via swift-evolution > <swift-evolution@swift.org> wrote: > > I am wondering, am I the only one that *strongly* prefers `yield` over > `await`? > > Superficially, `await` seems like the standard term, but given the fact that > the proposal is about coroutines, I think `yield` is actually the proper > name. Also, subjectively, it sounds much better/elegant to me!
Swift tends to take a pragmatic view of this kind of thing, naming features after their common uses rather than their formal names. For instance, there's no technical reason you *have* to use the error-handling features for errors—you could use them for routine but "special" return values like breaking out of a loop—but we still name things like the `Error` protocol and the `try` keyword in ways that emphasize their use for errors. This feature is about coroutines, sure, but it's a coroutine feature strongly skewed towards use for asynchronous calls, so we prefer syntax that emphasizes its async-ness. When you're reading the code, the fact that you're calling a coroutine is not important; what's important is that the code may pause for a while during a given expression and run other stuff in the meantime. `await` says that more clearly than `yield` would. -- Brent Royal-Gordon Architechies
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution