We present FJ&★, a new core calculus that extends Featherweight Java (FJ) with interfaces, -expressions, intersection types and a form of dynamic type. Intersection types can be used anywhere, in particular to specify target types of -expressions. The dynamic type is exploited to specify parts of the class tables and programs we want to exclude temporarily from static typing. Our main result is the gradual guarantee, which says that if a program is well typed in a class table, then replacing type annotations (from the program and from the class table) with the dynamic type always produces a program that is still well typed in the obtained class table. Furthermore, if a typed program evaluates to a value in a class table, then replacing type annotations with dynamic types always produces a program that evaluates to the same value in the obtained class table.
Gradual Guarantee for FJ with lambda-Expressions
Viviana Bono
;Mariangiola Dezani-Ciancaglini
;
2023-01-01
Abstract
We present FJ&★, a new core calculus that extends Featherweight Java (FJ) with interfaces, -expressions, intersection types and a form of dynamic type. Intersection types can be used anywhere, in particular to specify target types of -expressions. The dynamic type is exploited to specify parts of the class tables and programs we want to exclude temporarily from static typing. Our main result is the gradual guarantee, which says that if a program is well typed in a class table, then replacing type annotations (from the program and from the class table) with the dynamic type always produces a program that is still well typed in the obtained class table. Furthermore, if a typed program evaluates to a value in a class table, then replacing type annotations with dynamic types always produces a program that evaluates to the same value in the obtained class table.I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.