The Ultimate Conditional Syntax #260
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This paper was randomly selected as your next reading.
The Ultimate Conditional Syntax
Functional programming languages typically support expressive patternmatching syntax allowing programmers to write concise and typesafe code, especially appropriate for manipulating algebraic data types. Many features have been proposed to enhance the expressiveness of stock patternmatching syntax, such as pattern bindings, pattern alternatives a.k.a. disjunction, pattern conjunction, view patterns, pattern guards, pattern synonyms, active patterns, iflet patterns, multiway ifexpressions, etc. In this paper, we propose a new patternmatching syntax that is both more expressive and we argue simpler and more readable than previous alternatives. Our syntax supports parallel and nested matches interleaved with computations and intermediate bindings. This is achieved through a form of nested multiway ifexpressions with a conditionsplitting 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 MLfamily programming language. We describe a straightforward desugaring pass from our rich source syntax into a minimal core syntax that only supports
Cheng, Luyu, and Lionel Parreaux. “The Ultimate Conditional Syntax. Proceedings of the ACM on Programming Languages, vol. 8, no. OOPSLA2, Oct. 2024, pp. 9881017. Crossref, https://doi.org/10.1145/3689746.
Merge this PR to apply selection.