📝Function color


§ Programming Language


What Color is Your Function?

Colored functions is when a language has different kinds of function with different ways to call them that creates a division and pain.


  • sync/async functions. Callbacks, promises, async/await keywords—they all create a distinction

  • generator function in JS


  • In Haskell and Go, there is no distinction between sync/async functions. They all look the same and are called the same way. The code looks sync, but in reality, the language runtime parks the green thread on IO and switches to a different thread.

  • § Continuation, call with current continuation can be hidden within an async function, so the call looks perfectly normal.

  • Zig functions are colorless—Zig has (optional) M:N concurrency.