Scala中简单递归函数的类型推断

G. Nagy, G. Oláh, Z. Porkoláb
{"title":"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":"{\"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}","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

摘要

Scala是一种完善的多范式编程语言,以其简洁而闻名,包括高级类型推断功能。不幸的是,这种类型推断算法不支持递归函数的类型。这既违背了Scala最初的设计理念,又给程序员带来了不必要的负担。在本文中,我们提出了一种在Scala中计算简单递归函数返回类型的方法。基于非递归执行分支对返回类型进行了启发式假设,并证明了该方法的正确性。该算法对编译速度没有明显影响。我们在Scala编译器中使用扩展原型实现了我们的方法,并使用它在各种示例中成功地测试了我们的方法。编译器extensionprototype可用于进一步的测试。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Type Inference of Simple Recursive Functions in Scala
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.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信