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 FGG to an untyped lambda-calculus. The translation of an 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 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.
翻译:Feather weighter General Go (FGG) 是模拟编程语言基本特征的最小核心计算法(FGG) 。 它包括支持超载方法、 界面类型、 结构小打字和通用 。 FGG 程序动态行为的最直接的语义描述是, 解决基于接收器运行时间类型信息的方法调用。 文章显示了一种不同的方法, 定义了从 FGG 到非类型 羊羔算法的翻译。 FGG 程序的翻译提供了可用方法作为额外字典参数的证据, 类似于Haskell 类中已知的字典传译方法。 然后, 方法调用可以通过在字典中简单查看方法定义来解答。 翻译图像中的每个程序与源FGGG程序具有相同的动态语义。 这一结果的证明基于一种合成法、 级索引逻辑关系。 级索引确保了在存在递归界面类型和递归方法时的关联性定义。