Advanced
Compilers & Programming Language Theory
Q82 / 100
What is intersection types in programming languages?
Correct! Well done.
Incorrect.
The correct answer is B) Types allowing a value to simultaneously inhabit multiple types: x : A ∩ B means x can be used where both A and B are expected, enabling more precise typing than union
B
Correct Answer
Types allowing a value to simultaneously inhabit multiple types: x : A ∩ B means x can be used where both A and B are expected, enabling more precise typing than union
Explanation
Intersection types (A ∩ B): the term has both behaviors. f : (Int→Int) ∩ (String→String) can specialize its behavior. More expressive than union. Used in TypeScript (A&B), Scala, and type theory for overloading.
Progress
82/100