Skip to content

Instantly share code, notes, and snippets.

@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 23, 2024 03:59
Swift Concurrency Manifesto
@lattner
lattner / async_swift_proposal.md
Last active April 21, 2024 09:43 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

anonymous
anonymous / gist:7824bc6f9e06c31992f8
Created September 3, 2014 07:31
flying colours — http://tmblr.co/ZOLwww1PtWsW-
// by dw @ bees & bombs
int[][] result;
float t;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
anonymous
anonymous / gist:4e1ad2bc0e83ffab9acf
Created September 1, 2014 18:02
torus
int[][] result;
float t;
void setup() {
setup_();
result = new int[width*height][3];
}
void draw() {
anonymous
anonymous / gist:4255977085d958c8df71
Created September 1, 2014 08:47
hexagon wave
// by dave & beesandbombs
int[][] result;
float t;
void setup() {
setup_();
result = new int[width*height][3];
}