Cory Benfield - Building Protocol Libraries The Right Way - PyCon 2016
PyCon 20162 HN recommenders · recommended in 2 months, 2016–2024
talk · intermediate · evergreen · 2016–2024 on HN
Cory Benfield's PyCon 2016 talk on building protocol libraries that can be reused widely, using the Python Hyper HTTP project as the example. He argues for separating protocol parsing from I/O.
HN points to it as the foundational argument for sans-I/O protocol library design.
Up next
1 mo on HNI installed Linux (so should you)
PewDiePie
1 HN recommend · 2025–2025
6 mo on HNSimplicity Ain't Easy - Stuart Halloway
ClojureTV
5 HN recommender · 2013–2017
9 mo on HNHarder Drive: Hard drives we didn't want or need
suckerpinch
12 HN recommender · 2022–2025
9 mo on HNThis Video Is Sponsored By ███ VPN
Tom Scott
9 HN recommender · 2019–2026
6 mo on HNA New Way to look at Networking
Google
6 HN recommender · 2011–2018
6 mo on HNNet Neutrality: Last Week Tonight with John Oliver (HBO)
LastWeekTonight
7 HN recommender · 2014–2017
4 mo on HNCharacters, Symbols and the Unicode Miracle - Computerphile
Computerphile
4 HN recommender · 2014–2025
5 mo on HN8 Frames in 16ms: Rollback Networking in Mortal Kombat and Injustice 2
GDC Festival of Gaming
4 HN recommender · 2020–2025
4 mo on HNA New Way to look at Networking
GoogleTalksArchive
4 HN recommender · 2012–2025
4 mo on HNWhy SpaceX is Making Starlink
Real Engineering
4 HN recommender · 2019–2020
3 mo on HNAWS re:Invent 2015 | (NET403) Another Day, Another Billion Packets
Amazon Web Services
3 HN recommender · 2017–2020
3 mo on HNEmail Hates the Living
m
3 HN recommender · 2015–2022
3 comments from Hacker News
In some cases it is very practical, even in other (non functional) programming languages. For example, link (and its accompanying talk ▶ this video ) give some really great brainfood about the way currently all kinds of network protocols are implemented, and the benefits of separating the protocol (Logic) from the actual implementation (IO). You might also want to query Google or DDG for "Free monads" if you want to implement a similar layered approach in a functional language such as Scala or Haskell.
Cory Benfield's PyCon talk last week, "Building Protocol Libraries the Right Way" ( ▶ this video ), makes the argument that a large number of problems can be traced to not cleanly separating responsibilities of actually physically doing I/O and making semantic sense of the bytes. His primary worry was about reimplementing things like HTTP many times, once for each I/O framework (why do Twisted, Tornado, and asyncio all have their own HTTP implementation?). But it seems the same problem can be seen here: every single part of the code thinks it knows how to actually retrieve data from the network, so it interacts with the network on its own, causing nested polling and similar awkwardness. If every part of the event-processing code thinks it knows how to do network I/O, you have many more opportunities for getting network I/O wrong. If xterm were designed so that e.g. xevents() had only the responsibility of fetching bytes from the X socket and do_xevents() and everything else had only the responsibility of handling bytes from an buffer, there would be no temptation to poll in two different functions. Only one function would even know that the byte source is a socket; the rest just know about the buffer.
The above sans-io page links to this PyCon 2016 talk: Cory Benfield - Building Protocol Libraries The Right Way ▶ this video