The Ultimate Conditional SyntaxOOPSLA 2024 Distinguished Paper Award
Functional programming languages typically support expressive pattern-matching syntax that allows programmers to write concise, expressive, and type-safe code for manipulating algebraic data types. Many features have been proposed to enhance the expressiveness of pattern-matching syntax, such as pattern bindings, pattern alternatives (a.k.a. disjunction), pattern conjunction, view patterns, pattern guards, pattern synonyms, active patterns, ‘if-let’ patterns, multi-way if-expressions, etc. In this paper, we propose a new framework for expressing pattern-matching code in a way that is both more expressive and (we argue) more readable than previous alternatives. Our syntax subsumes many proposed pattern matching extensions by enabling the expression of parallel and nested matches interleaved with computations and intermediate bindings. This is achieved through a form of nested multi-way if-expressions with a condition-splitting mechanism to factor common conditional prefixes as well as a binding technique we call conditional pattern flowing. We motivate this new syntax with many examples in the setting of MLscript, a new ML-family programming language. We describe a straightforward desugaring pass from our rich source syntax into a minimal core syntax that only supports flat pattern matching (i.e., without nested patterns) along with an intuitive small-step semantics for the core syntax. We also formalize a translation from the core syntax into a normalized syntax without backtracking that is more amenable to type checking, coverage checking, and compilation. We then formally prove that our translation preserves the semantics of the core syntax. We view this work as a step towards rethinking pattern-matching to make it more expressive and readable. Our syntax could easily be integrated, in part or in whole, into existing as well as future programming language designs.
Fri 25 OctDisplayed time zone: Pacific Time (US & Canada) change
13:50 - 15:30 | Novel Programming Concepts and ParadigmsOOPSLA 2024 at IBR West Chair(s): Tobias Wrigstad Uppsala University | ||
13:50 20mTalk | A Case for First-Class Environments OOPSLA 2024 DOI | ||
14:10 20mTalk | Deriving Dependently-Typed OOP from First PrinciplesOOPSLA 2024 Distinguished Artifact Award OOPSLA 2024 David Binder University of Tübingen, Ingo Skupin University of Tübingen, Tim Süberkrüb Aleph Alpha, Klaus Ostermann University of Tübingen DOI | ||
14:30 20mTalk | Multiverse Notebook: Shifting Data Scientists to Time Travelers OOPSLA 2024 DOI | ||
14:50 20mTalk | The Ultimate Conditional SyntaxOOPSLA 2024 Distinguished Paper Award OOPSLA 2024 Luyu Cheng Hong Kong University of Science and Technology, Lionel Parreaux HKUST (The Hong Kong University of Science and Technology) DOI | ||
15:10 20mTalk | Unifying Static and Dynamic Intermediate Languages for Accelerator Generators OOPSLA 2024 Caleb Kim Massachusetts Institute of Technology (MIT), Pai Li Cornell University, USA, Anshuman Mohan Cornell University, Andrew Butt Cornell University, Adrian Sampson Cornell University, Rachit Nigam Massachusetts Institute of Technology DOI |