Content area

Abstract

The semantics of gradually typed languages is typically given indirectly via an elaboration into a cast calculus. This contrasts with more conventional formulations of programming language semantics, where the semantics of a language is given directly using, for instance, an operational semantics. This paper presents a new approach to give the semantics of gradually typed languages directly. We use a recently proposed variant of small-step operational semantics called type-directed operational semantics (TDOS). In a TDOS, type annotations become operationally relevant and can affect the result of a program. In the context of a gradually typed language, type annotations are used to trigger type-based conversions on values. We illustrate how to employ a TDOS on gradually typed languages using two calculi. The first calculus, called \(\lambda B^{g}\), is inspired by the semantics of the blame calculus, but it has implicit type conversions, enabling it to be used as a gradually typed language. The second calculus, called \(\lambda e\), explores an eager semantics for gradually typed languages using a TDOS. For both calculi, type safety is proved. For the \(\lambda B^{g}\) calculus, we also present a variant with blame labels and illustrate how the TDOS can also deal with such an important feature of gradually typed languages. We also show that the semantics of \(\lambda B^{g}\) with blame labels is sound and complete with respect to the semantics of the blame calculus, and that both calculi come with a gradual guarantee. All the results have been formalized in the Coq theorem prover.

Details

Title
Type-directed operational semantics for gradual typing
Author
YE, WENJIA 1   VIAFID ORCID Logo  ; BRUNO C D S OLIVEIRA 2 

 The University of Hong Kong, Hong Kong, China, (e-mail: [email protected]
 The University of Hong Kong, Hong Kong, China, (e-mail: [email protected]
Publication title
Volume
34
Publication year
2024
Publication date
Sep 2024
Publisher
Cambridge University Press
Place of publication
Cambridge
Country of publication
United Kingdom
ISSN
09567968
e-ISSN
14697653
Source type
Scholarly Journal
Language of publication
English
Document type
Journal Article
Publication history
 
 
Online publication date
2024-09-26
Milestone dates
2022-01-13 (Received); 2024-01-30 (Revised); 2024-05-09 (Accepted)
Publication history
 
 
   First posting date
26 Sep 2024
ProQuest document ID
3109569512
Document URL
https://www.proquest.com/scholarly-journals/type-directed-operational-semantics-gradual/docview/3109569512/se-2?accountid=208611
Copyright
© The Author(s), 2024. Published by Cambridge University Press. This work is licensed under the Creative Commons Attribution License This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited. (the “License”). Notwithstanding the ProQuest Terms and Conditions, you may use this content in accordance with the terms of the License.
Last updated
2024-09-26
Database
ProQuest One Academic