Gradual Typing for Python, Unguarded
Total Page:16
File Type:pdf, Size:1020Kb
GRADUAL TYPING FOR PYTHON, UNGUARDED Michael M. Vitousek Submitted to the faculty of the University Graduate School in partial fulfillment of the requirements for the degree Doctor of Philosophy in the School of Informatics, Computing, and Engineering Indiana University May 2019 Accepted by the Graduate Faculty, Indiana University, in partial fulfillment of the requirements for the degree of Doctor of Philosophy. Doctoral Committee Jeremy G. Siek, Ph.D. Sam Tobin-Hochstadt, Ph.D. Amr Sabry, Ph.D. Lawrence S. Moss, Ph.D. September 5, 2018 ii Copyright © 2019 Michael M. Vitousek iii For Ani. iv Acknowledgements In some sense I’m acknowledging the people who have made me who I am today—that’s the kind of dominant role that grad school has in life, or at least in mine. This dissertation is a story about gradual typing, but it’s also an artifact of me growing up: of the transition from young adulthood to… well, whatever it is that comes next. As such, there’s a lot of emotions instilled in this document, and pro- ducing it took the support—intellectual, social, emotional—of so many other people. Mentioning them all is, of course, impossible. But I’m gonna try and thank a few. The most important professional mentor I’ve had is of course my advisor, the inimitable Jeremy G. Siek. Starting from when I emailed him my undergrad senior thesis and asked him if he was looking for stu- dents (he replied with thoughtful suggestions on how to improve my thesis and an invitation to come meet with him), to my first couple years of training and instruction at the University of Colorado, and through my more independent research at Indiana, Jeremy has consistently supported me and helped me succeed. His “evil hat” has driven many thoughtful critiques of my work that have vastly strength- ened the end result, and his patience and warmth have made his office a comfortable place to express my thoughts and ideas. Maybe most importantly, he’s adapted his style for every stage of my career with him: spending a ton of time getting me up to speed when I started out, to working closely together on new ideas as I began to stretch my wings in research, to providing hands-off support as I developed my own ideas and my own program. I’ve never felt seriously neglected nor have I felt that my freedom to explore was limited, and that balance has been deeply important to my development as a scientist. I’m looking forward to having Jeremy as a colleague and as a friend in the future. Of course, Jeremy isn’t alone in shaping my career. Similarly important have been my outstanding re- search committee as well as many other faculty members who I’ve worked with. Sam Tobin-Hochstadt has been a thoughtful, detailed, and enjoyable mentor to have, and his perspective has always improved v my work and clarified my thinking. Beyond gradual typing, Amr Sabry’s comments and questions over the years have made me a better researcher, and Larry Moss has helped me shape and target this disser- tation to be as effective as I can make it. Back at University of Colorado, Evan Chang played a critical role in my first years in graduate school, and is a lot of why, even as my research has focused on lan- guage design, I still approach a lot of problems through the lens of static analysis. Finally, Liz Bradley’s Intro to the PhD Program class at Colorado played a crucial role in helping me navigate the challenges of graduate school, and I’m grateful for how she helped me grow a foundation of research skills that I’ve built upon. A few other mentors in my academic life come to mind, who I can thank (or, perhaps, blame?) for putting me on this path. Willamette University’s computer science department was a formative place for me— and how could I not end up as a programming languages researcher after I went to a department with a total of four faculty, two of whom were PL folks? John Lasseter was the first professor with whom I had a real rapport for research, and working with him on undergraduate research solidified my interest in the study of programming languages. He is also one of the kindest people I know, and working with him was always rewarding. Fritz Ruehr further guided me as I approached graduate school and helped me navigate through my senior thesis, graduate school applications, and health complications. My other undergraduate advisor from my history degree also shaped who I am as a researcher: this thesis doesn’t often touch on, say, Cold War politics or political transformations in the Eastern Bloc, but Bill Smaldone helped develop my critical thinking and writing skills more than almost anyone else. Finally, I have to mention my first computer science instructor, Gunn High School’s Josh Paley. His wit and genuine kindness made him as fantastic of a teacher as I can imagine, and I was probably cursed to be a programming language researcher from the beginning, given that his first classes covered both Scheme and Java and encouraged us to think about the differences between them. vi Of course, it isn’t just teachers, professors, and advisers that form the groundwork for success in a grad- uate program. Equally important to me have been my friends and colleagues in my programs, both at Indiana and Colorado, who have both been excellent professional colleagues and have formed a per- sonal support system that I’ve always been able to rely on. There are, of course, too many folks to mention, but I’ll try to call out a few. At Colorado, I owe a lot to friends like Mario (BRADDAH); Daniel and Angela (thanks for turning me on to homebrewing, a hobby that also probably is responsible for me surviving graduate school); Anshul and Mariah (and now Liara!); Hal, Andy, and the rest of the sadly defunct Distinguished Cooking Series crew; and Shashank and Jonathan, my first lab-mates in the program. At Indiana, I want to mention Chris (a fellow CU ex-pat whose clever ideas are even bigger than his dog), Mike and Tori, Andre and Laura, Matthew, Kyle, Jaime, Spenser, Rajan, and many other fantastic drinking buddies; and the outstanding gradual typing crew, equal parts friends and research colleagues, Matteo, Andrew, Sarah, David, Caner, and Ambrose (among others mentioned elsewhere). I especially have to mention though my dude Cameron Swords, who has been as close of a friend and as outstanding of a colleague as anyone could ask for. He and his wife Rebecca—a similarly awesome person—have been some of my closest friends in Bloomington ever since the day Cam cold-emailed me after a homotopy type theory class and demanded we get a drink together sometime. We’ve been coau- thors on a top tier paper, a bunch of delicious fermented beverages, and a bizarre role-playing game or two, and when we work together on anything the result is always over-the-top and awesome. Naturally, funding support has been essential in completing this work, and there are several institutions and organizations that have helped me significantly along the way. Fellowships from the University of Colorado made my funding situation for my first two years very straightforward, and I’m honored and grateful for the support they granted me. The National Science Foundation funded most of the latter part of my degree, as did funds from Indiana University itself. Google’s Lime Scholarship provided me with important travel funding throughout my degree, and a generous grant from Facebook enabled me vii to finish this dissertation by funding my last year in the program. I’m grateful for and humbled by the support from each of these institutions. The last and most important people I want to mention are my family. The best thing that graduate school did for me, and the reason I’m so grateful that I moved to Indiana with Jeremy, was giving me the opportunity to meet “my person,” my fiancée Amanda. She’s been the kind of friend and partner that I wonder how I ever did without. Whether we’re discovering an awesome new brewery, hiking in Brown County or the California Coast Range, playing video games on a snowy day, or just spending time with each other, she makes me a better person, and it’s with her that I first really started to think about the future. I’m so excited for the rest of our lives, and I’m so grateful to have had her love and support as I completed this work. During graduate school I’ve watched my sister Liana start and finish college and a graduate program of her own, and I’ve watched her grow into an amazing woman. She’s forging a path for herself with deep strength and enthusiasm, and I’m really happy to be a part of it. I’m so proud to be her brother. Finally, the love and support of my parents, Pam and Peter, has made me who I am, and is behind everything I’ve done. Thank you, Mom and Dad, and I love you. viii Michael M. Vitousek GRADUAL TYPING FOR PYTHON, UNGUARDED Gradual typing integrates static and dynamic typing with the guarantee that statically typed regions of a program will never have their types violated even if they interact with dynamically typed regions. Traditionally, this guarantee has been achieved by using proxies to mediate when values flow between statically and dynamically typed code.