Promises are made to be broken: migrating R to strict semantics

Function calls in the R language do not evaluate their arguments, these are passed to the callee as suspended computations and evaluated if needed. After 25 years of experience with the language, there are very few cases where programmers leverage delayed evaluation intentionally and laziness comes...

Full description

Saved in:
Bibliographic Details
Published inProceedings of ACM on programming languages Vol. 5; no. OOPSLA; pp. 1 - 20
Main Authors Goel, Aviral, Ječmen, Jan, Krynski, Sebastián, Flückiger, Olivier, Vitek, Jan
Format Journal Article
LanguageEnglish
Published 01.10.2021
Online AccessGet full text

Cover

Loading…
More Information
Summary:Function calls in the R language do not evaluate their arguments, these are passed to the callee as suspended computations and evaluated if needed. After 25 years of experience with the language, there are very few cases where programmers leverage delayed evaluation intentionally and laziness comes at a price in performance and complexity. This paper explores how to evolve the semantics of a lazy language towards strictness-by-default and laziness-on-demand. To provide a migration path, it is necessary to provide tooling for developers to migrate libraries without introducing errors. This paper reports on a dynamic analysis that infers strictness signatures for functions to capture both intentional and accidental laziness. Over 99% of the inferred signatures were correct when tested against clients of the libraries.
ISSN:2475-1421
2475-1421
DOI:10.1145/3485478