Every program manages resources — memory, file handles, network connections. Most languages either hand the job to a garbage collector (slow, unpredictable) or to the programmer directly (fast, but catastrophically easy to get wrong: leak the resource, free it twice, or use it after it's gone).
Linear types offer a third way. A linear value must be consumed exactly once: you can't ignore it (no leak) and you can't use it again after it's consumed (no double-free, no use-after-free). The compiler enforces this at compile time — no runtime cost at all.
The idea traces back to Jean-Yves Girard's linear logic (1987), a logic where hypotheses are resources rather than eternal truths: using a hypothesis once consumes it. Translating that into type theory gives you a type checker that tracks ownership the way an accountant tracks money.
Modern languages like Rust build their entire ownership and borrowing model on this foundation. Every value has a single owner; moving it transfers ownership; the compiler rejects any program that would leave a resource orphaned or double-consumed.
Comments
Loading comments...