skip to main content
10.1145/1141277.1141609acmconferencesArticle/Chapter ViewAbstractPublication PagessacConference Proceedingsconference-collections
Article

Introducing safe unknown types in Java-like languages

Published: 23 April 2006 Publication History

Abstract

Most mainstream object-oriented languages, like C++, Java and C#, are statically typed. In recent years, untyped languages, in particular scripting languages for the web, have gained a lot of popularity notwithstanding the fact that the advantages of static typing, such as earlier detection of errors, are widely accepted. We think that one of the main reasons for their widespread adoption is that, in many situations, the ability of ignoring types can be handy to write simpler and more readable code.We propose an extension of Java-like languages which allows developers to forget about typing in strategic places of their programs without losing type-safety. That is, we allow programmers to write simpler code without sacrificing the advantages of static typing. This is achieved by means of inferred type constraints. These constraints describe the implicit requirements on untyped code to be correctly invoked.This flexibility comes at a cost: field accesses and method invocations on objects of unknown types are less efficient than regular field accesses and method invocations. Also, our type system is currently more restrictive than it should be; its extension is the subject of ongoing work. However, the novel approach presented here is quite interesting on its own, as it supports separate compilation and there is zero runtime overhead on code which does not take advantage of the new features.

References

[1]
D. Ancona, F. Damiani, S. Drossopoulou, and E. Zucca. Polymorphic bytecode: Compositional compilation for Java-like languages. In ACM Symp. on Principles of Programming Languages 2005, 2005.
[2]
M. Day, R. Gruber, B. Liskov, and A. C. Meyers. Subtypes vs. where clauses: Constraining parametric polymorphism. In OOPSLA '95 Conference Proceedings, volume 30(10) of ACM SIGPLAN Notices, pages 156--168, 1995.
[3]
J. Eifrig, S. Smith, and V. Trifonov. Sound polymorphic type inference for objects. In OOPSLA '95 Conference Proceedings, volume 30(10) of ACM SIGPLAN Notices, pages 169--184, 1995.
[4]
J. Eifrig, S. Smith, and V. Trifonov. Type inference for recursively constrained types and its application to OOP. In Mathematical Foundations of Programming Semantics, New Orleans, volume 1 of Electronic Notes in Theoretical Computer Science. Elsevier, 1995. http://www.elsevier.nl/locate/entcs/volume1.html.
[5]
A. Igarashi, B. Pierce, and P. Wadler. Featherweight Java: A minimal core calculus for Java and GJ. In ACM Symp. on Object-Oriented Programming: Systems, Languages and Applications 1999, pages 132--146, November 1999.
[6]
A. C. Myers, J. A. Bank, and B. Liskov. Parameterized Types for Java. In ACM Symp. on Principles of Programming Languages 1997, pages 132--145, 1997.
[7]
J. Palsberg. Type inference for objects. CSURV: Computing Surveys, 28, 1996.
[8]
J. Palsberg and M. I. Schwartzbach. Object-oriented type inference. ACM SIGPLAN Notices, 26(11):146--161, November 1991.
[9]
T. Wang and S. F. Smith. Precise constraint-based type inference for Java. Lecture Notes in Computer Science, 2072:99--??, 2001.

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
SAC '06: Proceedings of the 2006 ACM symposium on Applied computing
April 2006
1967 pages
ISBN:1595931082
DOI:10.1145/1141277
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

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 23 April 2006

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. java-like languages
  2. static typing
  3. type-systems

Qualifiers

  • Article

Conference

SAC06
Sponsor:

Acceptance Rates

Overall Acceptance Rate 1,650 of 6,669 submissions, 25%

Upcoming Conference

SAC '25
The 40th ACM/SIGAPP Symposium on Applied Computing
March 31 - April 4, 2025
Catania , Italy

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 146
    Total Downloads
  • Downloads (Last 12 months)2
  • Downloads (Last 6 weeks)0
Reflects downloads up to 15 Feb 2025

Other Metrics

Citations

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