Back to Search Start Over

Type Inference of Simple Recursive Functions in Scala

Authors :
Zoltán Porkoláb
Gábor Oláh
Gergely Nagy
Source :
Acta Cybernetica. 25:797-815
Publication Year :
2020
Publisher :
University of Szeged, 2020.

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 this method's correctness. The algorithm does not have a significant effect on the compilation speed. We implemented our method as an extension prototype in the Scala compiler and used it to successfully test our method on various examples. The compiler extension prototype is available for further tests.

Details

ISSN :
2676993X and 0324721X
Volume :
25
Database :
OpenAIRE
Journal :
Acta Cybernetica
Accession number :
edsair.doi...........d0bd6dcc2c8d6f63d7615f28aa9f5343