skip to main content
10.1145/2093157.2093171acmotherconferencesArticle/Chapter ViewAbstractPublication PagespppjConference Proceedingsconference-collections
research-article

Well-typings for Javaλ

Published: 24 August 2011 Publication History

Abstract

In the last decade Java has been extended by some features, which are well-known from functional programming languages. In Java 8 the language will be expanded by closures (λ-expressions).
In our contribution we give a formal definition for an abstract syntax of a reduced language Javaλ with closures, define the type system, and formalize the subtyping relation. We define the set of types as an extension of the generic type definition for Java 5 types.
Finally, we give a type inference system, which describes the typings of Javaλ expressions and statements and we present a type inference algorithm. The type inference algorithm is an adaptation of a type inference algorithm for a typed λ--calculus.
The inferred types are well-typings. A well-typing is a conditional type for an expression, where the conditions are given by a set of consistent coercions.

References

[1]
Project lambda: Java language specification draft. http://mail.openjdk.java.net/pipermail/lambda-dev/attachments/20100212/af8d2cc5/attachment-0001.txt, 2010. Version 0.1.5.
[2]
G. Bracha, N. Gafter, J. Gosling, and P. von der Ahé. Closures for the java programming language (aka BGGA). http://www.javac.info.
[3]
S. Colebourne and S. Schulz. First-class methods: Java-style closures (aka FCM). http://docs.google.com/Doc?id=ddhp95vd_6hg3qhc.
[4]
L. Damas and R. Milner. Principal type-schemes for functional programs. Proc. 9th Symposium on Principles of Programming Languages, 1982.
[5]
Y.-C. Fuh and P. Mishra. Type inference with subtypes. Proceedings 2nd European Symposium on Programming (ESOP '88), pages 94--114, 1988.
[6]
B. Goetz. State of the lambda. http://cr.openjdk.java.net/~Briangoetz/lambda/lambda-state-3.html.
[7]
J. Gosling, B. Joy, G. Steele, and G. Bracha. The Java#8482; Language Specification. The Java series. Addison-Wesley, 3rd edition, 2005.
[8]
R. Hindley. The principle type scheme of an object in combinatory logic. Trans. Am. Math. Soc. 146, pages 29--60, December 1969.
[9]
S. Kaes. Parametric overloading in polymorphic programming languages. In H. Ganzinger, editor, Proceedings 2nd European Symposium on Programming (ESOP '88), volume 300 of Lecture Notes in Computer Science, pages 131--144, Nancy, France, Mar. 1988. Springer-Verlag.
[10]
B. Lee, D. Lea, and J. Bloch. Concise instance creation expressions: Closures without complexity (aka CICE). http://docs.google.com/Doc.aspx?id=k73_1ggr36h.
[11]
S. Marlow, editor. Haskell 2010 Language Report. http://www.haskell.org, 2010.
[12]
A. Martelli and U. Montanari. An efficient unification algorithm. ACM Transactions on Programming Languages and Systems, 4:258--282, 1982.
[13]
R. Milner. The definition of Standard ML (Revised). MIT Press, Cambridge, Mass., 1997.
[14]
R. Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17:348--378, 1978.
[15]
M. Odersky. The Scala language specication version 2.8, November 2010. Draft.
[16]
M. Odersky and P. Wadler. Pizza into Java: Translating theory into practice. In Proceedings of the 24th ACM Symposium on Principles of Programming Languages, January 1997.
[17]
M. Odersky, C. Zenger, and M. Zenger. Colored local type inference. Proc. 28th ACM Symposium on Principles of Programming Languages, 36(3):41--53, 2001.
[18]
M. Odersky, P. Altherr, V. Cremet, I. D. G. Dubochet, B. Emir, S. McDirmid, S. Micheloud, N. Mihaylov, M. Schinz, E. Stenman, L. Spoon, and M. Zenger. An overview of the scala programming language. Technical report, École Polytechnique Fédérale de Lausanne (EPFL), 2006. LAMP-REPORT-2006-001.
[19]
B. C. Pierce and D. N. Turner. Local type inference. In Proceedings of the 25th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '98, pages 252--265, 1998.
[20]
M. Plümicke. Typeless Programming in Java 5.0 with wildcards. In V. Amaral, L. Veiga, L. Marcelino, and H. C. Cunningham, editors, 5th International Conference on Principles and Practices of Programming in Java, volume 272 of ACM International Conference Proceeding Series, pages 73--82, September 2007.
[21]
M. Plümicke. Java type unification with wildcards. In D. Seipel, M. Hanus, and A. Wolf, editors, 17th International Conference, INAP 2007, and 21st Workshop on Logic Programming, WLP 2007, Wrzburg, Germany, October 4--6, 2007, Revised Selected Papers, volume 5437 of Lecture Notes in Artificial Intelligence, pages 223--240. Springer-Verlag Heidelberg, 2009.
[22]
J. Skeet. C# in Depth. Manning Publications Co., second edition, 2010.

Cited By

View all
  • (2017)Introducing Scala-like function types into Java-TXProceedings of the 14th International Conference on Managed Languages and Runtimes10.1145/3132190.3132203(23-34)Online publication date: 27-Sep-2017

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
PPPJ '11: Proceedings of the 9th International Conference on Principles and Practice of Programming in Java
August 2011
186 pages
ISBN:9781450309356
DOI:10.1145/2093157
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

  • DTU: Technical University of Denmark
  • ORACLE: ORACLE

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 24 August 2011

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. code generation
  2. language design
  3. program design and implementation
  4. type inference
  5. type system

Qualifiers

  • Research-article

Conference

PPPJ '11
Sponsor:
  • DTU
  • ORACLE
PPPJ '11: Principles and Practice of Programming in Java
August 24 - 26, 2011
Kongens Lyngby, Denmark

Acceptance Rates

Overall Acceptance Rate 29 of 58 submissions, 50%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)2
  • Downloads (Last 6 weeks)1
Reflects downloads up to 13 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2017)Introducing Scala-like function types into Java-TXProceedings of the 14th International Conference on Managed Languages and Runtimes10.1145/3132190.3132203(23-34)Online publication date: 27-Sep-2017

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media