Type Inference of Simple Recursive Functions in Scala

G. Nagy, G. Oláh, Z. Porkoláb
{"title":"Type Inference of Simple Recursive Functions in Scala","authors":"G. Nagy, G. Oláh, Z. Porkoláb","doi":"10.14232/actacyb.282762","DOIUrl":null,"url":null,"abstract":"Scala is a well-established multi-paradigm programming language known for itsterseness that includes advanced type inference features. Unfortunately thistype inferring algorithm does not support typing of recursive functions.This is both against the original design philosophies of Scala and puts anunnecessary burden on the programmer. In this paper we propose a method tocompute the return types for simple recursive functions in Scala. We makea heuristic assumption on the return type based on the non-recursive executionbranches and provide a proof of this method's correctness. The algorithm does not havea significant effect on the compilation speed. We implemented our method asan extension prototype in the Scala compiler and used itto successfully test our method on various examples. The compiler extensionprototype is available for further tests.","PeriodicalId":187125,"journal":{"name":"Acta Cybern.","volume":"33 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2020-10-22","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Acta Cybern.","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.14232/actacyb.282762","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

Scala is a well-established multi-paradigm programming language known for itsterseness that includes advanced type inference features. Unfortunately thistype inferring algorithm does not support typing of recursive functions.This is both against the original design philosophies of Scala and puts anunnecessary burden on the programmer. In this paper we propose a method tocompute the return types for simple recursive functions in Scala. We makea heuristic assumption on the return type based on the non-recursive executionbranches and provide a proof of this method's correctness. The algorithm does not havea significant effect on the compilation speed. We implemented our method asan extension prototype in the Scala compiler and used itto successfully test our method on various examples. The compiler extensionprototype is available for further tests.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
Scala中简单递归函数的类型推断
Scala是一种完善的多范式编程语言,以其简洁而闻名,包括高级类型推断功能。不幸的是,这种类型推断算法不支持递归函数的类型。这既违背了Scala最初的设计理念,又给程序员带来了不必要的负担。在本文中,我们提出了一种在Scala中计算简单递归函数返回类型的方法。基于非递归执行分支对返回类型进行了启发式假设,并证明了该方法的正确性。该算法对编译速度没有明显影响。我们在Scala编译器中使用扩展原型实现了我们的方法,并使用它在各种示例中成功地测试了我们的方法。编译器extensionprototype可用于进一步的测试。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Proving the Stability of the Rolling Navigation Inverses of Rational Functions Quantification of Time-Domain Truncation Errors for the Reinitialization of Fractional Integrators On Some Convergence Properties for Finite Element Approximations to the Inverse of Linear Elliptic Operators The Inventory Control Problem for a Supply Chain With a Mixed Type of Demand Uncertainty
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1