当前位置: X-MOL 学术J. Funct. Program. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
A type-directed, dictionary-passing translation of method overloading and structural subtyping in Featherweight Generic Go
Journal of Functional Programming ( IF 1.1 ) Pub Date : 2023-10-09 , DOI: 10.1017/s0956796823000047
MARTIN SULZMANN , STEFAN WEHR

Featherweight Generic Go (FGG) is a minimal core calculus modeling the essential features of the programming language Go. It includes support for overloaded methods, interface types, structural subtyping, and generics. The most straightforward semantic description of the dynamic behavior of FGG programs is to resolve method calls based on runtime type information of the receiver. This article shows a different approach by defining a type-directed translation from ${\textrm{FGG}^{-}}$ to an untyped lambda-calculus. ${\textrm{FGG}^{-}}$ includes all features of FGG but type assertions. The translation of an ${\textrm{FGG}^{-}}$ program provides evidence for the availability of methods as additional dictionary parameters, similar to the dictionary-passing approach known from Haskell type classes. Then, method calls can be resolved by a simple lookup of the method definition in the dictionary. Every program in the image of the translation has the same dynamic semantics as its source ${\textrm{FGG}^{-}}$ program. The proof of this result is based on a syntactic, step-indexed logical relation. The step index ensures a well-founded definition of the relation in the presence of recursive interface types and recursive methods. Although being non-deterministic, the translation is coherent.

中文翻译:

Featherweight Generic Go 中方法重载和结构子类型的类型定向、字典传递翻译

Featherweight Generic Go (FGG) 是一种最小核心微积分,对 Go 编程语言的基本特征进行建模。它包括对重载方法、接口类型、结构子类型和泛型的支持。FGG程序动态行为最直接的语义描述是根据接收者的运行时类型信息来解析方法调用。本文通过定义类型定向翻译展示了一种不同的方法 ${\textrm{FGG}^{-}}$ 到无类型的 lambda 演算。 ${\textrm{FGG}^{-}}$ 包括 FGG 除类型断言之外的所有功能。的翻译 ${\textrm{FGG}^{-}}$ 程序提供了方法作为附加字典参数的可用性的证据,类似于 Haskell 类型类中已知的字典传递方法。然后,方法调用可以通过在字典中简单查找方法定义来解决。翻译图像中的每个程序都具有与其源相同的动态语义 ${\textrm{FGG}^{-}}$ 程序。该结果的证明基于句法、步进索引的逻辑关系。步骤索引确保在存在递归接口类型和递归方法的情况下对关系进行有根据的定义。尽管翻译是不确定的,但翻译是连贯的。
更新日期:2023-10-09
down
wechat
bug