Publication: Subtyping with Generics: A Unified Approach
dc.contributor.advisor | Yannis Smaragdakis | |
dc.contributor.advisor | Jack C. Wileden | |
dc.contributor.advisor | Neil Immerman | |
dc.contributor.advisor | Ian Grosse | |
dc.contributor.author | Altidor, John G | |
dc.contributor.department | University of Massachusetts Amherst | |
dc.date | 2023-09-23 10:03:22 | |
dc.date.accessioned | 2024-04-26T15:29:40Z | |
dc.date.available | 2024-04-26T15:29:40Z | |
dc.date.issued | 2014 | |
dc.date.submitted | February | |
dc.date.submitted | 2014 | |
dc.description.abstract | Reusable software increases programmers' productivity and reduces repetitive code and software bugs. Variance is a key programming language mechanism for writing reusable software. Variance is concerned with the interplay of parametric polymorphism (i.e., templates, generics) and subtype (inclusion) polymorphism. Parametric polymorphism enables programmers to write abstract types and is known to enhance the readability, maintainability, and reliability of programs. Subtyping promotes software reuse by allowing code to be applied to a larger set of terms. Integrating parametric and subtype polymorphism while maintaining type safety is a difficult problem. Existing variance mechanisms enable greater subtyping between parametric types, but they suffer from severe deficiencies. They are unable to express several common type abstractions. They can cause a proliferation of types and redundant code. They are difficult for programmers to use due to its inherent complexity. This dissertation aims to improve variance mechanisms in programming languages supporting parametric polymorphism. To address the shortcomings of current mechanisms, I will combine two popular approaches, definition-site variance and use-site variance, in a single programming language. I have developed formal languages or calculi for reasoning about variance. The calculi are example languages supporting both notions of definition-site and use-site variance. They enable stating precise properties that can be proved rigorously. The VarLang calculus demonstrates fundamental issues in variance from a language neutral perspective. The VarJ calculus illustrates realistic complications by modeling a mainstream programming language, Java. VarJ not only supports both notions of use-site and definition-site variance but also language features with complex interactions with variance such as F-bounded polymorphism and wildcard capture. A mapping from Java to VarLang was implemented in software that infers definition-site variance for Java. Large, standard Java libraries (e.g. Oracle's JDK 1.6) were analyzed using the software to compute metrics measuring the benefits of adding definition-site variance to Java, which only supports use-site variance. Applying this technique to six Java generic libraries shows that 21-47% (depending on the library) of generic definitions are inferred to have single-variance; 7-29% of method signatures can be relaxed through this inference, and up to 100% of existing wildcard annotations are unnecessary and can be elided. Although the VarJ calculus proposes how to extend Java with definition-site variance, no mainstream language currently supports both definition-site and use-site variance. To assist programmers with utilizing both notions with existing technology, I developed a refactoring tool that refactors Java code by inferring definition-site variance and adding wildcard annotations. This tool is practical and immediately applicable: It assumes no changes to the Java type system, while taking into account all its intricacies. This system allows users to select declarations (variables, method parameters, return types, etc.) to generalize and considers declarations not declared in available source code. I evaluated our technique on six Java generic libraries. I found that 34% of available declarations of variant type signatures can be generalized-i.e., relaxed with more general wildcard types. On average, 146 other declarations need to be updated when a declaration is generalized, showing that this refactoring would be too tedious and error-prone to perform manually. The result of applying this refactoring is a more general interface that supports greater software reuse. | |
dc.description.degree | Doctor of Philosophy (PhD) | |
dc.description.department | Computer Science | |
dc.identifier.doi | https://doi.org/10.7275/6056894.0 | |
dc.identifier.orcid | N/A | |
dc.identifier.uri | https://hdl.handle.net/20.500.14394/17758 | |
dc.relation.url | https://scholarworks.umass.edu/cgi/viewcontent.cgi?article=1284&context=dissertations_2&unstamped=1 | |
dc.source.status | published | |
dc.subject | subtyping | |
dc.subject | variance | |
dc.subject | wildcards | |
dc.subject | generics | |
dc.subject | polymorphism | |
dc.subject | programming languages | |
dc.subject | Programming Languages and Compilers | |
dc.subject | Software Engineering | |
dc.subject | Theory and Algorithms | |
dc.title | Subtyping with Generics: A Unified Approach | |
dc.type | dissertation | |
digcom.contributor.author | isAuthorOfPublication|email:jaltidor@cs.umass.edu|institution:University of Massachusetts Amherst|Altidor, John G | |
digcom.identifier | dissertations_2/153 | |
digcom.identifier.contextkey | 6056894 | |
digcom.identifier.submissionpath | dissertations_2/153 | |
dspace.entity.type | Publication |
Files
Original bundle
1 - 1 of 1
Loading...
- Name:
- AltidorDiss2014.pdf
- Size:
- 985.51 KB
- Format:
- Adobe Portable Document Format