Motivation [000T]

Currently, Swarm has a relatively standard Hindley-Milner type system, with an extra requirements analysis bolted on top. The goal of the requirements analysis is to decide what capabilities (and hence what devices) are required to execute some code, and to facilitate automatically installing necessary devices on newly built robots.

However, the bolted-on requirements analysis is fundamentally broken, and has led to a number of bugs. For example, see the following issues:

Fundamentally, the problem is that a proper requirements analysis must be done statically (requirements analysis for programs passed to the build command are currently done dynamically, at runtime, leading to a number of bugs), and can't be separated from type analysis (e.g. to be able to deal properly with requirements of higher-order functions).

The goal of this work is to design a unified type-and-requirements system that handles things properly, using the lessons learned over the past few years of struggling with the current implementation.