Kotlin

Mixed-Site Variance

FOOL 2013: [pdf] (Quick Tutorial on Formal Notation) [bibtex]

Author: Ross Tate

In collaboration with Andrey Breslav on Kotlin at JetBrains

Call for Industry Endorsement

Please e-mail me if you endorse this paper, meaning you agree with the arguments made in the paper. Please provide me your full name, title, and organization (and optionally a URL to link to); I will keep your e-mail private except when requested by reviewers for confirmation. Note that this endorsement does not mean that you think mixed-site variance is the best thing ever, just that the arguments I make reflect your thoughts and experiences where applicable. If by chance they do not, I would be interested to learn your perspective!

Why should you bother? I (and many others) would like to help solve your problems. The challenge we face is that many of your problems are hard to discuss scientifically. Indeed, industry tends to improve by reflecting on experiences, at least when it comes to programming-language development. Unfortunately, we academics need to publish in scientific conferences and journals, and personal experience is not a scientific process. Our reviewers may very well like what we have to say, but they may not be comfortable accepting a paper founded on heresay into a scientific venue. Indeed, after reading positive reviews and then being rejected, through side channels I was informed such concerns were this paper's downfall, and I was encouraged to try unconventional avenues. So, this is an experiment to enable industry to encourage research directions they would like explored despite the difficulty in scientifically backing claims. In other words, this is an attempt to make industry experience admissible as evidence in academic settings, just like they do in industry settings.

One more way to contribute would be to offer links to related blog posts. I could experiment with citing them within the paper to corroborate my claims. For example, multiple reviewers have asked me to support the claim that wildcards have failed. Every industry developer I have spoken with familiar with wildcards has strongly agreed, but I know of no documentation of this sentiment. Educators and students, I would be interested in your opinions and experiences as well.

Abstract

Java introduced wildcards years ago. Wildcards were very expressive, and they were integral to updating the existing libraries to make use of generics. Unfortunately, wildcards were also complex and verbose, making them hard and inconvenient for programmers to adopt. Overall, while an impressive feature, wildcards are generally considered to be a failure. As such, many languages adopted a more restricted feature for generics, namely declaration-site variance, because designers believed its simplicity would make it easier for programmers to adopt. Indeed, declaration-site variance has been quite successful. However, it is also completely unhelpful for many designs, including many of those in the Java SDK. So, we have designed mixed-site variance, a careful combination of definition-site and use-site variance that avoids the failings of wildcards. We have been working with JetBrains to put this into practice by incorporating it into the design of their upcoming language, Kotlin. Here we exposit our design, our rationale, and our experiences.

Questions, Comments, and Suggestions

If you have any questions, comments, or suggestions, please e-mail me. I would be glad to know of any opinions people have or any clarifications I should make.