Open and Closed Universes

Type systems are essential for modeling reality, with types representing different choices that can be either fixed (closed universe) or evolving over time (open universe). Closed universes, like enums in Rust, limit options to known values, ensuring stability, while open universes may require non-exhaustive enums to accommodate future changes without breaking the API. Using strings or traits can be beneficial for fully open universes, with traits offering flexibility at the cost of complexity. Sealed traits can create semi-open universes allowing library expansions without consumer interference. Each approach has its strengths and trade-offs, depending on the specific needs.

https://sunshowers.io/posts/open-closed-universes/

To top