Programming Language Theory Flashcard
What are the general strategies for handling partiality in type systems?
Books
Decktype theory
Question
What are the general strategies for handling partiality in type systems?
Answer
Exception
Pros: Simple.
Cons: Lie about its contract.
Option type
Pros: Simple & Truthful about contract.
Cons: Do not interoperate with legacy systems. Require migration. Caller needs to explicitly handle error case.
Refined type
Pros: Extremely type-safe and truthful about its contract.
Cons: Undecidable.