...
首页> 外文期刊>Logical Methods in Computer Science >Java & Lambda: a Featherweight Story
【24h】

Java & Lambda: a Featherweight Story

机译:Java和Lambda:轻量级故事

获取原文

摘要

We present FJ&$lambda$, a new core calculus that extends Featherweight Java(FJ) with interfaces, supporting multiple inheritance in a restricted form,$lambda$-expressions, and intersection types. Our main goal is to formalisehow lambdas and intersection types are grafted on Java 8, by studying theirproperties in a formal setting. We show how intersection types play asignificant role in several cases, in particular in the typecast of a$lambda$-expression and in the typing of conditional expressions. We alsoembody interface emph{default methods} in FJ&$lambda$, since they increasethe dynamism of $lambda$-expressions, by allowing these methods to be calledon $lambda$-expressions. The crucial point in Java 8 and in our calculus is that $lambda$-expressionscan have various types according to the context requirements (target types):indeed, Java code does not compile when $lambda$-expressions come withouttarget types. In particular, in the operational semantics we must record targettypes by decorating $lambda$-expressions, otherwise they would be lost in theruntime expressions. We prove the subject reduction property and progress for the resultingcalculus, and we give a type inference algorithm that returns the type of agiven program if it is well typed. The design of FJ&$lambda$ has been drivenby the aim of making it a subset of Java 8, while preserving the elegance andcompactness of FJ. Indeed, FJ&$lambda$ programs are typed and behave the sameas Java programs.
机译:我们介绍FJ&$ lambda $,这是一种新的核心演算,它扩展了Featherweight Java(FJ)的接口,支持受限形式的多重继承,$ lambda $表达式和交集类型。我们的主要目标是通过在正式的环境中研究lambda和交集类型的属性,形式化如何将它们移植到Java 8上。我们展示了交集类型在几种情况下如何发挥重要作用,尤其是在$ lambda $表达式的类型转换和条件表达式的类型中。我们还将接口 emph {默认方法}包含在FJ&$ lambda $中,因为它们通过允许调用$ lambda $表达式来提高$ lambda $表达式的动态性。在Java 8和我们的演算中,关键点是$ lambda $ -expressionscan根据上下文要求(目标类型)具有各种类型:实际上,当$ lambda $ -expressions没有目标类型时,Java代码不会编译。特别地,在操作语义中,我们必须通过修饰$ lambda $表达式来记录目标类型,否则它们将在运行时表达式中丢失。我们证明了主题归约性质和所得演算的进展,并给出了类型推断算法,如果类型正确,该算法将返回给定程序的类型。 FJ&$ lambda $的设计的驱动力是使其成为Java 8的子集,同时又保留了FJ的优雅和紧凑性。实际上,FJ&$ lambda $程序的类型和行为与Java程序相同。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号