[swift-evolution] await keyword "scope"

Brent Royal-Gordon brent at architechies.com
Fri Sep 15 06:50:37 CDT 2017


> On Sep 12, 2017, at 12:48 PM, Adam Kemp via swift-evolution <swift-evolution at swift.org> wrote:
> 
> @IBAction func buttonDidClick(sender:AnyObject) {
>     beginAsync {
>         let image = await processImage(downloadImage(), resize: self.resizeSwitch.isOn)
>         displayImage(image)
>     }
> }

Would it be possible to actually fix this? That is, make the code covered by the `await` evaluate synchronous subexpressions first, such that the code sample above is equivalent to this?

	@IBAction func buttonDidClick(sender:AnyObject) {
	    beginAsync {
		let $temp1 = self.resizeSwitch.isOn
		let $temp2 = await downloadImage()
	        let image = await processImage($temp2, resize: $temp1)
	        displayImage(image)
	    }
	}

-- 
Brent Royal-Gordon
Architechies

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


More information about the swift-evolution mailing list