Philosophy & History of the Result Pattern

The Result pattern is older than most languages that use it. Understanding where it came from makes it obvious why it belongs in modern C#.

The problem: two kinds of failure, one mechanism

Every program deals with two very different kinds of failure. Exceptional failures — out of memory, corrupted state, broken invariants — are things the current operation cannot meaningfully respond to. Expected failures — a user typed an invalid email, an account wasn't found, a payment was declined — are ordinary, anticipated outcomes of the domain.

Exceptions are a good tool for the first kind and a poor one for the second. When expected failures travel as exceptions, four things go wrong:

  • The signature lies. Customer GetCustomer(string id) claims to always return a customer. The failure mode is invisible until it detonates at runtime.
  • Control flow becomes non-local. A throw is a hidden goto — the reader can't see where handling happens without tracing every caller.
  • Handling is optional. Nothing forces a caller to catch. Forgotten catches are found in production.
  • It's slow. Stack unwinding costs orders of magnitude more than returning a value — a real tax when "failure" happens thousands of times per minute as normal business.

The Result pattern's answer: make failure a value. A function that can fail returns a type that says so — Result<Customer> — and the type system makes handling it as unavoidable as using the value itself. The signature becomes honest, the failure path becomes visible, and the compiler becomes your reviewer.

A brief history

1960s–70s — error codes
C returned integers and set errno. Failure-as-value, but untyped, easily ignored, and disconnected from the value it accompanied. The right instinct without the type system to enforce it.
1980s–90s — sum types and Either
ML-family languages introduced algebraic data types: a value that is exactly one of several tagged alternatives. Haskell's Maybe and Either e a made "value or error" a first-class, pattern-matchable type — and its monadic composition (do notation, 1990s) solved the ergonomics: chain computations and let the first failure short-circuit. Every modern Result library is a descendant of this idea — including the LINQ query you write with QuickResult, which is C#'s closest cousin to do notation.
2003 — checked exceptions cautionary tale
Java tried to force failure-handling through the type system with checked exceptions. The goal was right; the mechanism fought the language (no composition, no generics integration) and taught the industry that failure contracts must compose to be usable.
2010s — Rust makes Result mainstream
Rust shipped without exceptions: Result<T, E> and the ? operator are the error mechanism. A systems language proved that failure-as-value scales to entire ecosystems, and a generation of developers came to expect it.
2013 — "Railway-Oriented Programming"
Scott Wlaschin's F# talk gave the pattern its most durable metaphor: a function is a piece of two-track railway. Success rides the top track; the first failure switches the train to the bottom track, which bypasses every later step. F# later added a built-in Result type (F# 4.1, 2017).
2015–present — the C# ecosystem
C# gained the ingredients — expression-bodied members, pattern matching, records, nullable reference types — and a family of Result libraries grew: LanguageExt, CSharpFunctionalExtensions, FluentResults, ErrorOr. Each picks a point on the spectrum between "full functional toolkit" and "minimal result type".

Where QuickResult sits

QuickResult stakes out a deliberate position in that spectrum:

  • LINQ-first. C# already ships a monadic composition syntax — query expressions. Rather than inventing a fluent DSL, QuickResult teaches Result to speak it, including the part other libraries stumble on: mixing sync and async steps in one query.
  • Minimal, not maximal. One namespace, a dozen public types, zero dependencies. It's a Result type, not a functional-programming worldview — you can adopt it in one method of a legacy codebase this afternoon.
  • Pragmatic at the edges. Real .NET code meets exceptions and nulls constantly, so Try, TryAsync, FromNullable, and WhenNull are front-door APIs, not afterthoughts.
  • Exceptions still exist. QuickResult doesn't abolish exceptions — it reserves them for what they're good at: the truly exceptional. Broken invariants should still throw. Declined payments should not.

The test

A simple heuristic for choosing between a Result and an exception: would you write this failure into the user story? "When the account is not found, show a message" — that's domain behavior, and it deserves a place in the type signature. "When the heap is exhausted…" — nobody writes that story. Let it throw.

Something went wrong. This site returns Results, not exceptions — please reload. ✕