Fortran ASYN FUNCTION NGCD(NA, NB) IA = NA IB = NB 1 IF (IB.NE.0) THEN ITEMP = IA IA = IB IB = AWAI MOD(ITEMP, IB) GOTO 1 END IF NGCD = IA RETURN END (actually I'm not so sure about Fortran)
Help Me!!! • I get the big picture (concurrency). But... • Is it a replacement for Tornado/Twisted? • Is it a layer that everyone should use? • Is it an reference implementation of an API? • Also: How do I teach this?
Some History Threads Polling def handle_echo(client): while True: data = client.recv(10000) if not data: break client.sendall(data) while True: r, w, _ = select(readers, writers, [] for s in r: handle_read(s) for s in w: handle_write(s)
Defending asyncio • Think about everything going on here • It is a complicated problem • It is an important problem • But, it has a complicated history • Each part requires deep study • A lot of smart people have worked on it
Questions • Can an async API exist independently of an async implementation? • Maybe • It seems that it should be possible • Especially if you embrace async/await
It's Interesting • The design of such an API is interesting • What operations require "await"? • Consistency in the interface • Interconnections between parts • Can you isolate it from the runtime?