From Surf Wiki (app.surf) — the open knowledge base
Phase distinction
Phase Distinction is a property of programming languages that observe a strict division between types and terms. A concise rule for determining whether phase distinction is preserved in a language or not has been proposed by Luca Cardelli - If A is a compile-time term and B is a subterm of A, then B must also be a compile-time term.
Most statically typed languages conform to the principle of phase distinction. However, some languages with especially flexible and expressive type systems (notably dependently typed programming languages) allow types to be manipulated in the same ways as regular terms. They may be passed to functions or returned as results.
A language with phase distinction may have separate namespaces for types and run-time variables. In an optimizing compiler, phase distinction marks the boundary between expressions which are safe to erase.
Theory
Phase distinction is used in conjunction with static checking. By using a calculus based system, phase distinction removes the need to enforce linear logic between different types and terms of programming.
Introduction
Phase Distinction distinguishes between processing to be done at compile-time versus processing done at runtime.
Consider a simple language, with terms:
t ::= true | false | x | λx : T . t | t t | if t then t else t
and types:
T ::= Bool | T - T
Note how types and terms are distinct. At compile time, types are used to verify the validity of the terms. However, types do not play any role at runtime.
References
References
- Cardelli, Luca. (3 January 1988). "Phase Distinctions in Type Theory". [[Digital Equipment Corporation]].
- Cardelli, Luca. (3 January 1988). "Phase Distinctions in Type Theory". [[Digital Equipment Corporation]].
- (31 January 2008). "CMSC 336: Type Systems for Programming Languages; Lecture 7: Curry-Howard Isomorphism & Derived Forms".
This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.
Ask Mako anything about Phase distinction — get instant answers, deeper analysis, and related topics.
Research with MakoFree with your Surf account
Create a free account to save articles, ask Mako questions, and organize your research.
Sign up freeThis content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.
Report