Programming Language Theory Flashcard
Why is union type popular in retrofitted type systems?
Books
Concepts
Deckcompiler implementation
Question
Why is union type popular in retrofitted type systems?
Answer
In previously untyped languages, code can return values of multiple types, for example, valid results & errors.
-> This must be typable in the retrofitted type system.
-> Either union types or sum types. However, sum types require modifying the logic of existing code, rather than the more trivial type annotation additions.