Repository logo
 

A modular foreign function interface

Accepted version
Peer-reviewed

Type

Article

Change log

Authors

Yallop, J 

Abstract

Foreign function interfaces are typically organised monolithically, tying together the specification of each foreign function with the mechanism  used to make the function available in the host language. This leads to inflexible systems, where switching from one binding mechanism to another (say from dynamic binding to static code generation) often requires changing tools and rewriting large portions of code.

We show that ML-style module systems support exactly the kind of abstraction needed to separate these two aspects of a foreign function binding, leading to declarative foreign function bindings that support switching between a wide variety of binding mechanisms — static and dynamic, synchronous and asynchronous, etc. — with no changes to the function specifications.

Note. This is a revised and expanded version of an earlier paper, Declarative Foreign Function Binding Through Generic Programming. This paper brings a greater focus on modularity, and adds new sections on error handling, and on the practicality of the approach we describe.

Description

Keywords

foreign functions, functional programming, modularity

Journal Title

Science of Computer Programming

Conference Name

Journal ISSN

0167-6423
1872-7964

Volume Title

Publisher

Elsevier
Sponsorship
Engineering and Physical Sciences Research Council (EP/K008528/1)