Charles Explorer logo
🇬🇧

Static closures for functional languages

Publication at Faculty of Mathematics and Physics |
2018

Abstract

In current functional programming environments, the first-class functions with implicitly passed closures are usually represented as structures called thunks. Typical methods of thunk processing require non-trivial run-time support in form of allocation and garbage collection, which may negatively impact performance and restricts applicability of the language in low-level environments, such as embedded devices, operating systems and kernels.

We present an algorithm that statically converts all implicitly passed function scopes (that would otherwise be converted to thunks) to explicitly defined static closures. The approach can be used to simplify translation of purely functional programs to highly-performant lower-level languages.

Performance impact of the conversion and subsequent compilation to low-level code is demonstrated on several programs.