- Author
- Joe Duffy
- Published
- February 7, 2016
- Kind
- Long personal blog post, a design retrospective with code samples
- Original
- joeduffyblog.com/2016/02/07/the-error-model/
- Subject
- Programming languages and types
What it is
Joe Duffy describes the error model of Midori, an operating system using a C# variant. The post is the first in a planned series on that language. It recounts years of design changes.
What it says
- The post argues a language should separate bugs from recoverable errors.
- Midori handled bugs by abandonment, a fail-fast teardown that ran no user code.
- Recoverable errors used checked exceptions. A method could throw only if marked throws, and each call site said try.
- Preconditions written with requires replaced most argument-checking exceptions seen in .NET and Java.
- In a dual-mode test, exceptions were 7% smaller and 4% faster than return codes.
- Treating unintended overflow as a bug helped avoid a bug 9 times in 10.
- The post says reliability comes from isolated processes that can fail and be restarted.
What evidence it gives
The post offers code samples and its own experience over several years. It reports a few ratios, such as bug abandonment outnumbering recoverable errors by about 10:1. It tells one anecdote of a port where 80% of zh-tw requests failed.
Interests and limits
The blog header names Duffy as Founder/CEO of Pulumi. The post says Midori never shipped. Its figures come from internal work and cannot be checked here. An earlier post holds the full benchmark results.