Andrew W. Keep and R. Kent Dybvig. Ftypes: Structured foreign types. Scheme 2011: Workshop on Scheme and Functional Programming, October 2011
High-level programming languages, like Scheme, typically represent data in ways that differ from the host platform to support consistent behavior across platforms and automatic storage management, i.e., garbage collection. While crucial to the programming model, differences in data representation can complicate interaction with foreign programs and libraries that employ machinedependent data structures that do not readily support garbage collection. To bridge this gap, many high-level languages feature foreign function interfaces that include some ability to interact with foreign data, though they often do not provide complete control over the structure of foreign data, are not always fully integrated into the language and run-time system, and are often not as efficient as possible. This paper describes a Scheme syntactic abstraction for describing foreign data, a set of operators for interacting with that data, and an implementation that together provide a complete, well integrated, and efficient solution for handling structured data outside the Scheme heap.