Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
research:software:gradual-unions [2017/05/02 13:22] – [Local execution of the prototype implementation] mtoro | research:software:gradual-unions [2019/06/24 19:09] (current) – etanter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Gradual Unions: A Gradual Interpretation of Union Types ====== | ====== Gradual Unions: A Gradual Interpretation of Union Types ====== | ||
+ | |||
+ | See [[http:// | ||
Union types allow to capture the possibility of a term to be of several possibly unrelated types. Traditional static approaches to union types are untagged and tagged unions, which present dual advantages in their use. Inspired by recent work on using abstract interpretation to understand gradual typing, we present a novel design for union types, called gradual union types. Gradual union types combine the advantages of tagged and untagged union types, backed by dynamic checks. Seen as a gradual typing discipline, | Union types allow to capture the possibility of a term to be of several possibly unrelated types. Traditional static approaches to union types are untagged and tagged unions, which present dual advantages in their use. Inspired by recent work on using abstract interpretation to understand gradual typing, we present a novel design for union types, called gradual union types. Gradual union types combine the advantages of tagged and untagged union types, backed by dynamic checks. Seen as a gradual typing discipline, | ||
Line 11: | Line 13: | ||
* How to install the prototype implementation of GSEC< | * How to install the prototype implementation of GSEC< | ||
* An overview of the application and a basic presentation of the language syntax. | * An overview of the application and a basic presentation of the language syntax. | ||
- | * Detailed examples | + | * Examples |
+ | An online version of this document can be found [[https:// | ||
===== Installation instructions ===== | ===== Installation instructions ===== | ||
Line 19: | Line 21: | ||
- **Using the online implementation** at [[https:// | - **Using the online implementation** at [[https:// | ||
- | - **With the provided virtual machine**, which can also be downloaded | + | - **With the provided virtual machine**, which can also be downloaded [[https:// |
- | - **Local execution of the prototype, which can be downloaded [[https:// | + | - **Local execution of the prototype**, which can be downloaded [[https:// |
The **online implementation** does not require any installation and is always up-to-date. If you want to get a snapshot of the current state of the interpreter (as of May 1, 2017), then follow the instructions for points 2 or 3. | The **online implementation** does not require any installation and is always up-to-date. If you want to get a snapshot of the current state of the interpreter (as of May 1, 2017), then follow the instructions for points 2 or 3. | ||
Line 102: | Line 104: | ||
A term can be a typed lambda abstraction, | A term can be a typed lambda abstraction, | ||
- | Types can be booleans Bool, integers Int, unknown | + | Types can be booleans |
==== The action area ==== | ==== The action area ==== | ||
Line 132: | Line 134: | ||
{{: | {{: | ||
- | Each step shows in red the redux. | + | Each step shows the redux in red. |
- | Note as program | + | Note as programs |
- | The reduction of the program is presented as the reduction of intrinsic terms: derivation trees augmented with evidence. An evidence reflects the justification of why a given consistent judgment holds. | + | The reduction of the program is presented as the reduction of //intrinsic terms//: derivation trees augmented with evidence. An evidence reflects the justification of why a given consistent judgment holds. |
Each derivation tree can be expanded by clicking the button on the top-right corner: | Each derivation tree can be expanded by clicking the button on the top-right corner: | ||
Line 159: | Line 161: | ||
- | ==== Errors | + | ==== Static and dynamic errors |
The prototype implementation reports static errors after the " | The prototype implementation reports static errors after the " | ||
- | {{: | + | {{: |
Now let us add an ascription to the boolean value: | Now let us add an ascription to the boolean value: | ||
Line 173: | Line 175: | ||
==== Combining gradual unions and the unknown type ==== | ==== Combining gradual unions and the unknown type ==== | ||
- | This is an example of combining the use of gradual unions and the unknown type. The applied lambda receives either a function that receives an Int, or a function that returns an Int. | + | This is an example of combining the use of gradual unions and the unknown type. The applied lambda receives either a function that receives an '' |
{{: | {{: | ||
- | This program, as we are passing a function from Int to Int the program run without errors. | + | This program |
Now consider the following program: | Now consider the following program: | ||
{{: | {{: | ||
- | This time we are passing as argument a function from Bool to Int, so the program also run without errors. | + | This time we are passing as argument a function from '' |
But if we consider this program: | But if we consider this program: | ||
Line 188: | Line 190: | ||
{{: | {{: | ||
- | We are now passing a function from Bool to Bool, so the program fails statically as (Int -> ?) + (? -> Int) is not consistent with Bool -> Bool. | + | We are now passing a function from '' |
If we add an ascription to the argument: | If we add an ascription to the argument: | ||
{{: | {{: | ||
- | Then the program typechecks but fails at runtime as it fails to justify that (Int -> ?) + (? -> Int) is consistent with Bool -> Bool. | + | Then the program typechecks but fails at runtime as it fails to justify that '' |