Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Absence and failure

A calculation may have no answer, or it may fail with an explanation. Make those possibilities part of its type, and let the caller choose what to do.

  1. Represent absence
  2. Represent a recoverable error
  3. Supply a default or a typed error
  4. Give constructors enough type information
  5. Propagate with ?
  6. Choose which error details to keep
  7. Keep several error types
  8. Build text with recoverable allocation