Linear Types Assume Convergence 0 ▲ Yosh Wuyts — Blog 2 hours ago · 9 min read1728 words · Tech · hide IntroductionLinear types are types whose values must be used exactly once, in all branches a program can take. To be “used” here means “used by some operation”, for example by passing, returning, storing, or destroying the value. This is as opposed to not being used in an operation, which in a stack language would be akin to the value being popped off the stack.1 1To expand on this: linear types are types which in the substructural types framework allow for “exchange”, but not “weakening” or “contraction”. In a stack language, this allows linear values to be reordered, but not freely discarded or duplicated: each must be consumed exactly once. Rust’s type system is affine, which means you can’t use a value after it’s been moved, preventing classes of bugs like use-after-free. Linear types are even stricter and require that a value must be used, preventing bugs like memory leaks. In this post I will cover how to encode linear types, their interaction with various language features, and… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town