当前位置:
X-MOL 学术
›
arXiv.cs.LO
›
论文详情
Our official English website, www.x-mol.net, welcomes your
feedback! (Note: you will need to create a separate account there.)
Effectiveness of Annotation-Based Static Type Inference
arXiv - CS - Logic in Computer Science Pub Date : 2020-08-28 , DOI: arxiv-2008.12545 Isabel Wingen, Philipp K\"orner
arXiv - CS - Logic in Computer Science Pub Date : 2020-08-28 , DOI: arxiv-2008.12545 Isabel Wingen, Philipp K\"orner
Benefits of static type systems are well-known: they offer guarantees that no
type error will occur during runtime and, inherently, inferred types serve as
documentation on how functions are called. On the other hand, many type systems
have to limit expressiveness of the language because, in general, it is
undecidable whether a given program is correct regarding types. Another concern
that was not addressed so far is that, for logic programming languages such as
Prolog, it is impossible to distinguish between intended and unintended failure
and, worse, intended and unintended success without additional annotations. In this paper, we elaborate on and discuss the aforementioned issues. As an
alternative, we present a static type analysis which is based on plspec.
Instead of ensuring full type-safety, we aim to statically identify type errors
on a best-effort basis without limiting the expressiveness of Prolog programs.
Finally, we evaluate our approach on real-world code featured in the SWI
community packages and a large project implementing a model checker.
中文翻译:
基于注解的静态类型推断的有效性
静态类型系统的好处是众所周知的:它们保证在运行时不会发生类型错误,并且本质上,推断类型用作关于如何调用函数的文档。另一方面,许多类型系统必须限制语言的表达能力,因为通常无法确定给定程序在类型方面是否正确。另一个目前尚未解决的问题是,对于诸如 Prolog 之类的逻辑编程语言,无法区分有意和无意的失败,更糟糕的是,如果没有额外的注释,就无法区分有意和无意的成功。在本文中,我们详细阐述并讨论了上述问题。作为替代方案,我们提供了一个基于 plspec 的静态类型分析。而不是确保完全类型安全,我们的目标是在尽最大努力的基础上静态识别类型错误,而不限制 Prolog 程序的表达能力。最后,我们在 SWI 社区包中的真实代码和一个实现模型检查器的大型项目上评估我们的方法。
更新日期:2020-08-31
中文翻译:
基于注解的静态类型推断的有效性
静态类型系统的好处是众所周知的:它们保证在运行时不会发生类型错误,并且本质上,推断类型用作关于如何调用函数的文档。另一方面,许多类型系统必须限制语言的表达能力,因为通常无法确定给定程序在类型方面是否正确。另一个目前尚未解决的问题是,对于诸如 Prolog 之类的逻辑编程语言,无法区分有意和无意的失败,更糟糕的是,如果没有额外的注释,就无法区分有意和无意的成功。在本文中,我们详细阐述并讨论了上述问题。作为替代方案,我们提供了一个基于 plspec 的静态类型分析。而不是确保完全类型安全,我们的目标是在尽最大努力的基础上静态识别类型错误,而不限制 Prolog 程序的表达能力。最后,我们在 SWI 社区包中的真实代码和一个实现模型检查器的大型项目上评估我们的方法。