Proceedings chapter
Open access

Featherweight Swift: A Core Calculus for Swift's Type System

Presented at November 16–17, 2020
Publication date2020

Swift is a modern general-purpose programming language, designed to be a replacement for C-based languages. Although primarily directed at development of applications for Apple's operating systems, Swift's adoption has been growing steadily in other domains, ranging from server-side services to machine learning. This success can be partly attributed to a rich type system that enables the design of safe, fast, and expressive programming interfaces. Unfortunately, this richness comes at the cost of complexity, setting a high entry barrier to exploit Swift's full potential. Furthermore, existing documentation typically only relies on examples, leaving new users with little help to build a deeper under- standing of the underlying rules and mechanisms. This paper aims to tackle this issue by laying out the foundations for a formal framework to reason about Swift's type system. We introduce Featherweight Swift, a minimal language stripped of all features not essential to describe its typing rules. Featherweight Swift features classes and protocol inheritance, supports retroactive modeling, and emulates Swift's overriding mechanisms. Yet its formalization fits on a few pages. We present Featherweight Swift's syntax and semantics. We then elaborate on the usability of our frame- work to reason about Swift's features, future extensions, and implementation by discussing a bug in Swift's compiler, discovered throughout the design of our calculus.

  • Protocol oriented programming
  • Language semantics
  • Language calculus
  • Type systems
  • Swift
  • Autre - DIP
Citation (ISO format)
RACORDON, Dimitri, BUCHS, Didier. Featherweight Swift: A Core Calculus for Swift’s Type System. In: Proceedings of the 13th ACM SIGPLAN International Conference on Software Language En- gineering (SLE ’20). [s.l.] : [s.n.], 2020.
Main files (1)
Proceedings chapter (Published version)
  • PID : unige:144345

Technical informations

Creation11/09/2020 10:47:00 AM
First validation11/09/2020 10:47:00 AM
Update time03/15/2023 11:00:49 PM
Status update03/15/2023 11:00:48 PM
Last indexation01/17/2024 11:26:56 AM
All rights reserved by Archive ouverte UNIGE and the University of GenevaunigeBlack