COOPERATIVE MULTITASKING
WITH GENERATORS

(please sit up front)

Hi, I'm Chris

We spend a lot of time waiting...

...But we can write asynchronous code.

Arrays

Array-likes

Iterators

Talk about generators!

Reading files

Sorting

Pure functions are like

data tables...

a + b a - b
a = 5, b = 4 9 1
a = 10, b = 10 20 0
0 1 9 20
a = 5, b = 4 ... a - b a + b ...
a = 10, b = 10 a - b ... ... a + b

Task manager

Generators can be used as interruptible functions

Otherwise known as coroutines

Asynchronous architecture in about 65 lines of code

Meet AMPHP

amphp.org

Amp

Amp

Meet Recoil

github.com/recoilphp/recoil

Recoil

Async/await

Thanks

twitter.com/assertchris

slides.com/assertchris

joind.in/talk/80019