Get the latest tech news
Data evolution with set-theoretic types
We explore how set-theoretic types could address how many statically typed languages do not allow libraries to evolve their public data definitions in a backwards compatible manner. The proposed solution aims to be automatically verified by the compiler and type safe.
Long story short: we can support both old and new versions of Schema and all of the work will be done by the compiler and the type system to guarantee correctness, enabling library authors to provide a safer and better experience to developers. This will guarantee to the author of the Schema struct that users can safely upgrade their codebases through the revision preservation property, as the compiler and type system will assume r1 and r2 should coexist. From the theoretical point of view, the only capabilities necessary to make this work is structural subtyping, with unions, intersections, and negations, all available out of the box in Elixir’s set-theoretic type system.
Or read this on Hacker News