We propose a language design where types can be enriched by tags corresponding to predicates written by the programmer. For instance, int&positive; is a type, where positive is a user-defined boolean function on integers. Expressions of type int&positive; are obtained by an explicit check construct, analogous to cast, e.g., (positive) 2. In this way, the fact that the value of an expression is guaranteed to succeed a runtime check is a static property which can be controlled by the type system. We formalize our proposal as an extension of the simply-typed lambda calculus, and prove, besides soundness, the fact that expressions of tagged types reduce to values which satisfy the corresponding predicates.

Runtime checks as nominal types

ZUCCA, ELENA
2016-01-01

Abstract

We propose a language design where types can be enriched by tags corresponding to predicates written by the programmer. For instance, int&positive; is a type, where positive is a user-defined boolean function on integers. Expressions of type int&positive; are obtained by an explicit check construct, analogous to cast, e.g., (positive) 2. In this way, the fact that the value of an expression is guaranteed to succeed a runtime check is a static property which can be controlled by the type system. We formalize our proposal as an extension of the simply-typed lambda calculus, and prove, besides soundness, the fact that expressions of tagged types reduce to values which satisfy the corresponding predicates.
File in questo prodotto:
Non ci sono file associati a questo prodotto.

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/11567/858558
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 0
  • ???jsp.display-item.citation.isi??? ND
social impact