Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1557898.1557900acmotherconferencesArticle/Chapter ViewAbstractPublication PagesisstaConference Proceedingsconference-collections
research-article

Range parameterized types: use-site variance without the existential questions

Published: 06 July 2009 Publication History

Abstract

Use-site variance approaches such as Java wildcards allows to flexibly derive many co- and contravariant types from one generic class definition. Safety is achieved by restricting the access to members of the parameterized types, but the definition of proper access rules is complicated by the possible nesting of types. Existing approaches for use-site variance relate parameterized classes to bounded existential types and employ a conversion of the type parameters to fresh type variables in order to type an operation. This technique only indirectly explains the operations of a parameterized class and confronts the programmer with type variables which are introduced by the compiler for the purpose of type checking.
In this paper, we propose a more straightforward, uniform and powerful mechanism to systematically address the access restrictions of parameterized types with use-site variance. Parameterized classes receive two type values for each type parameter, and the operations may be determined by simply substituting these values in covariant resp. contravariant positions. The two type values may be interpreted as the bounds of a type range, and we define a safe and flexible variant subtype relation based on range containment. With the exception of wildcard capture, our approach supports all of the common features of other use-site variance models.

References

[1]
Y. Bertot and P. Castéran. Interactive Theorem Proving and Program Development --- Coq'Art: The Calculus of Inductive Constructions, volume XXV of Texts in Theoretical Computer Science. Springer, 2004.
[2]
G. Bracha and D. Griswold. Strongtalk: typechecking Smalltalk in a production environment. In Proc. of OOPSLA '93, pages 215--230. ACM Press, 1993.
[3]
N. Cameron, S. Drossopoulou, and E. Ernst. A model for Java wildcards. In Proc. of ECOOP 08, volume 5142 of Lecture Notes in Computer Science, pages 2--26. Springer Berlin, July 2008.
[4]
P. Canning, W. Cook, W. Hill, W. Olthoff, and J. C. Mitchell. F-bounded polymorphism for object-oriented programming. In Proc. 4th Int.' Conf. on Functional programming languages and computer architecture (FPCA '89), pages 273--280, New York, NY, USA, 1989. ACM.
[5]
L. Cardelli and P. Wegner. On understanding types, data abstraction, and polymorphism. ACM Computing Surveys, 17(4):471--522, Dec. 1985.
[6]
J. Gosling, B. Joy, G. Steele, and G. Bracha. The Java Language Specification. Addison-Wesley Professional, third edition, June 2005.
[7]
A. Igarashi, B. Pierce, and P. Wadler. Featherweight Java: A minimal core calculus for Java and GJ. In Proc. of OOPSLA '99, pages 132--146. ACM Press, Oct. 1999.
[8]
A. Igarashi and M. Viroli. On variance-based subtyping for parametric types. In B. Magnusson, editor, ECOOP 2002: Proceedings of the 16th European Conference on Object-Oriented Programming, volume 2374 of LNCS, pages 441--469. Springer, 2002.
[9]
A. Igarashi and M. Viroli. Variant parametric types: A flexible subtyping scheme for generics. ACM Transactions on Programming Languages and Systems (TOPLAS), 28(5):795--847, Sept. 2006.
[10]
J. C. Mitchell and G. D. Plotkin. Abstract types have existential type. ACM Transactions on Programming Languages and Systems, 10(3):470--502, July 1988.
[11]
M. Odersky and other. An overview of the Scala programming language. Technical Report LAMP-REPORT-2006-001, École Polytechnique Fédérale de Lausanne (EPFL), 2006.
[12]
B. C. Pierce. Types and Programming Languages. The MIT Press, Feb. 2002.
[13]
M. Torgersen, E. Ernst, and C. P. Hansen. Wild FJ. In 12th International Workshop on Foundations of Object-Oriented Languages (FOOL 12), Jan. 2005.
[14]
M. Torgersen, C. P. Hansen, E. Ernst, P. von der Ahé, G. Bracha, and N. M. Gafter. Adding wildcards to the Java programming language. In H. Haddad, A. Omicini, R. L. Wainwright, and L. M. Liebrock, editors, Proc. of the 2004 ACM Symposium on Applied Computing (SAC), pages 1289--1296. ACM Press, 2004.
[15]
M. Viroli and G. Rimassa. On access restriction with Java wildcards. Journal of Object Technology, 4(10):117--139, Dec. 2005.

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
FTfJP '09: Proceedings of the 11th International Workshop on Formal Techniques for Java-like Programs
July 2009
64 pages
ISBN:9781605585406
DOI:10.1145/1557898
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]

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 06 July 2009

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. generic classes
  2. language design
  3. language semantics
  4. subtyping
  5. variance

Qualifiers

  • Research-article

Conference

ECOOP '09

Acceptance Rates

FTfJP '09 Paper Acceptance Rate 10 of 15 submissions, 67%;
Overall Acceptance Rate 51 of 75 submissions, 68%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 119
    Total Downloads
  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 28 Jan 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