arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1807.02132cs.PL
收藏

渐进式液体类型推断

Gradual Liquid Type Inference

Niki Vazou, Éric Tanter, David Van Horn

摘要:

液态类型提供了一种可判定的细化推理机制,它很方便,但有两个主要问题:(1)推理是全局的,需要顶级注释,这使得它不适合模块化代码组件的推理,并禁止其适用于库代码,以及(2)推理失败导致模糊的错误消息。这些困难严重阻碍了现有代码的迁移以使用改进。本文表明,逐步液体类型推断-液体推理和逐步细化类型的新组合-解决这两个问题。支持乐观解释的不精确谓词的渐进细化类型可以在参数位置中使用以约束流动推理,使得全局推理过程e有效地推断可用于库组件的模块化规范。双重地,当逐渐改进作为推理的结果出现时,它们表示静态改进的使用不一致。因为液体细化是从一个nite集合的谓词,在逐渐液体类型推断,我们可以枚举每个不精确的细化的安全具体化,即静态细化,证明为什么一个程序是逐渐良好的类型。此枚举对于静态液体类型错误的解释非常有用,因为安全具体化显示了导致静态类型错误的所有潜在不一致性。我们发展了渐进式液态类型推断理论,并在液态Haskell语言环境下对其语用进行了探讨。

英文摘要:

Liquid typing provides a decidable refinement inference mechanism that is convenient but subject to two major issues: (1) inference is global and requires top-level annotations, making it unsuitable for inference of modular code components and prohibiting its applicability to library code, and (2) inference failure results in obscure error messages. These difficulties seriously hamper the migration of existing code to use refinements. This paper shows that gradual liquid type inference---a novel combination of liquid inference and gradual refinement types---addresses both issues. Gradual refinement types, which support imprecise predicates that are optimistically interpreted, can be used in argument positions to constrain liquid inference so that the global inference process e effectively infers modular specifications usable for library components. Dually, when gradual refinements appear as the result of inference, they signal an inconsistency in the use of static refinements. Because liquid refinements are drawn from a nite set of predicates, in gradual liquid type inference we can enumerate the safe concretizations of each imprecise refinement, i.e. the static refinements that justify why a program is gradually well-typed. This enumeration is useful for static liquid type error explanation, since the safe concretizations exhibit all the potential inconsistencies that lead to static type errors. We develop the theory of gradual liquid type inference and explore its pragmatics in the setting of Liquid Haskell.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑