Chapter 4: Reading and debugging

Everything so far happened one line at a time, in order. As soon as a program has to wait for something, that stops being true.

Async and await

Also called Promise

Slow work, such as a network call, doesn't hold everything up. The program gets a promise of a result and moves on. await pauses one function until its promise finishes, and other code gets to run in the meantime.

A missing await is a classic almost-right bug: the code runs, nothing errors, and it reports success before the work has happened. Look for it in anything an agent writes that saves, sends or charges.

Say it to your agent

“Turn on the no-floating-promises rule from typescript-eslint, fix everything it reports, and list each place where a promise was not being awaited, saying what could have gone wrong there.”

The workshop

Name a word, or describe what you mean in everyday language.