What Color is Your Function?
Using an invented language where every function is either red or blue, the author shows what function coloring really means: red functions are asynchronous. Red can only be called from red, calls need special syntax, and some core library functions are red-only. The root cause is async IO: you must unwind the entire C callstack back to the event loop, so callbacks, promises, async-await and generators all end up manually reifying the callstack on the heap via a CPS transform. Async-await fixes rule four but not the split: sync functions return values, async ones return Future/Task wrappers that still need awaiting. Go, Lua and Ruby avoid coloring entirely by suspending whole goroutines, coroutines or fibers instead of returning. C# escapes the same way by using threads. Java, notably, never had the problem.