Context-oriented functional programming

File Description SizeFormat 
Martins-PM-2014-PhD-Thesis.pdfThesis945.13 kBAdobe PDFDownload
Title: Context-oriented functional programming
Author(s): Martins, Pedro M.
Item Type: Thesis or dissertation
Abstract: The modern computing landscape, featuring heterogeneous interconnected mobile devices, poses new challenges and opportunities for application development. Mobility and heterogeneity of devices imply that applications need to adapt depending on their execution context. Contexts such as the device that an application is running on, or the power profile, may require widespread program-wide adaptation. Dealing with this adaptation can lead to the introduction of subtle bugs, and subsequent runtime errors, such as null pointer exceptions when context has not been initialized. Current approaches to encoding context-aware behaviour are either very flexible but unsafe, or safe but too restrictive. In this thesis we present a new approach to context-aware application development based on functional programming, which attempts to be both flexible and safe. In order to do so, we present an embedded domain specific language in Haskell, where we explore the design space of context-dependent values within a functional programming language. In particular, we explore how to use Haskell's type system to automatically derive the context dependencies needed by a computation at the type level, and use this to ensure that required context is always available. We then develop context-dependent types to ensure safety in the presence of program-wide variation. By using different return types for different modes of operation of the program when appropriate, we can ensure isolation between them through type checking. We extend our domain specific language to support context-dependent types, whilst retaining type soundness, as well as sound and (we conjecture) complete type inference. We present a core calculus for these features and a high-level language that extends the calculus with practical programming features. Evaluation is performed by examining a context-aware application requiring exactly the kind of adaptation that is unsafe to implement in current approaches. We show that our language compares favourably to the state of the art in terms of both safety and code clarity.
Content Version: Open Access
Publication Date: Nov-2013
Date Awarded: Jun-2014
URI: http://hdl.handle.net/10044/1/24669
Advisor: McCann, Julie
Sponsor/Funder: Fundacao para a Ciencia e a Tecnologia
Funder's Grant Number: SFRH/BD/61917/2009
Department: Computing
Publisher: Imperial College London
Qualification Level: Doctoral
Qualification Name: Doctor of Philosophy (PhD)
Appears in Collections:Computing PhD theses



Items in Spiral are protected by copyright, with all rights reserved, unless otherwise indicated.

Creative Commons