We found a match
Your institution may have access to this item. Find your institution then sign in to continue.
- Title
Type Inference of Simple Recursive Functions in Scala.
- Authors
Nagy, Gergely; Oláh, Gábor; Porkoláb, Zoltán
- Abstract
Scala is a well-established multi-paradigm programming language known for its terseness that includes advanced type inference features. Unfortunately this type inferring algorithm does not support typing of recursive functions. This is both against the original design philosophies of Scala and puts an unnecessary burden on the programmer. In this paper we propose a method to compute the return types for simple recursive functions in Scala. We make a heuristic assumption on the return type based on the non-recursive execution branches and provide a proof of the correctness of this method. We implemented our method as an extension prototype in the Scala compiler and used it to successfully test our method on various examples. The algorithm does not have a significant effect on the compilation speed. The compiler extension prototype is available for further tests.
- Subjects
INFERENCE (Logic); TELEOLOGY; PROGRAMMING languages; COMPILERS (Computer programs); TEST methods; RECURSIVE functions; ALGORITHMS
- Publication
Acta Cybernetica, 2022, Vol 25, Issue 4, p797
- ISSN
0324-721X
- Publication type
Article
- DOI
10.14232/actacyb.282762