多态let生成代码:一首价值限制、价值共享的歌谣
Generating Code with Polymorphic let: A Ballad of Value Restriction, Copying and Sharing
摘要:
让多态性和突变等效应在同一种语言中共存是一个值得讲述的故事,在复制与共享的反复出现的情况下。我们在故事中添加了新的章节,关于生成具有多态性和效果的代码的考验,并确保它进行了类型检查。在Hindley-Milner类型系统中,生成良好类型的构造多态let表达式是不可能的:甚至作者也相信这一点。polymorphic-let generator是存在的。我们提出了它的推导和应用程序的轻量级实现报价通过一个新的和出乎意料的简单的源代码到源代码的转换生成组合子。然而,用多态函数生成let表达式需要的甚至比放松的值限制所能提供的更多。我们需要一个新的处理ML中的let多态性。我们推测较弱的限制,并实现它在一个实用的代码生成库。它的形式论证被表述为研究纲领。
英文摘要:
Getting polymorphism and effects such as mutation to live together in the same language is a tale worth telling, under the recurring refrain of copying vs. sharing. We add new stanzas to the tale, about the ordeal to generate code with polymorphism and effects, and be sure it type-checks. Generating well-typed-by-construction polymorphic let-expressions is impossible in the Hindley-Milner type system: even the author believed that. The polymorphic-let generator turns out to exist. We present its derivation and the application for the lightweight implementation of quotation via a novel and unexpectedly simple source-to-source transformation to code-generating combinators. However, generating let-expressions with polymorphic functions demands more than even the relaxed value restriction can deliver. We need a new deal for let-polymorphism in ML. We conjecture the weaker restriction and implement it in a practically-useful code-generation library. Its formal justification is formulated as the research program.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。