Semantic casts: Contracts and structural subtyping in a nominal world

Robert Bruce Findler*, Matthew Flatt, Matthias Felleisen

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review

3 Scopus citations


Nominal subtyping forces programmers to explicitly state all of the subtyping relationships in the program. This limits component reuse, because programmers cannot anticipate all of the contexts in which a particular class might be used. In contrast, structural subtyping implicitly allows any type with appropriate structure to be used in a given context. Languagues with contracts exacerbate the problem. Since contracts are typically expressed as refinements of types, contracts in nominally typed languages introduce additional obstacles to reuse. To overcome this problem we show how to extend a nominally typed language with semantic casts that introduce a limited form of structural subtyping. The new language must dynamically monitor contracts, as new subtyping relationships are exploited via semantic casts. In addition, it must also track the casts to properly assign blame in case interface contract are violated.

Original languageEnglish (US)
Pages (from-to)364-388
Number of pages25
JournalLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
StatePublished - 2004

ASJC Scopus subject areas

  • Theoretical Computer Science
  • Computer Science(all)


Dive into the research topics of 'Semantic casts: Contracts and structural subtyping in a nominal world'. Together they form a unique fingerprint.

Cite this