Modern computer programs do not run in the void. They run in rich environments that provide important data sources, services and other functionality that is required by the programs. For example, mobile applications access GPS locations, call server-side code over the network, access data from public REST-based services and so on. Yet, programming languages often assume that the initial context is an empty set.

In this talk, I’ll cover two research directions that make programming languages more context-aware. In the first part, I’ll discuss coeffects – a mechanism for tracking how computer programs access the environment in which they execute. Coeffects capture many practical notions of context (such as available resources in distributed computing), but can also model well-known properties (such as variable liveness or requirements in data-flow computations). In the second part of the talk, I’ll cover my work on type providers that integrates external data sources in the type system of a programming language and I’ll briefly outline interesting future research directions.