xwu
(Xiaodi Wu)
October 9, 2025, 11:24am
2
You may find this prior pitch of use:
Following @jrose 's draft proposal , @cal and I took a stab at fleshing out this pitch (below and also linked here ). A draft implementation is available here .
is case expressions
Introduction
It's often useful to check whether or not an enum matches a specific case. This is trivial for simple enums without associated values, but is not well-supported today for enum cases with associated values.
We should introduce a new is case expression that lets you evaluate the result of any pattern match…
It has also done the work of linking to quite a bit—and probably by no means all—of the prior discussions, which have evidently taken place about every year for at least the past decade:
Andrew Bennett was the first person who suggested the spelling is case for this operation, way back in 2015 .
Alex Lew (2015 ), Sam Dods (2016 ), Tamas Lustyik (2017 ), Suyash Srijan (2018 ), Owen Voorhees (2019 ), Ilias Karim (2020 ), and Michael Long (2021 ) have brought up this "missing feature" in the past, often generating good discussion. (There may have been more that we missed as well, and this isn't even counting "Using Swift" threads!)
Jon Hull (2018 ), among others, for related discussion on restructuring if case.
Since that post, at least one further discussion on the topic occurred in 2024 .
As you'll see from the linked thread, the language steering group provided feedback on the topic and how to proceed from here, but it's a bit of a heavy lift:
I'm sorry for leaving you hanging for so long. The Language Steering Group talked about this proposal. We agree that there's a lot of room for improvement in this part of the language, and this specific proposal seems to be high-quality: it is thorough and well thought out. Nevertheless, we don't feel comfortable running proposals in the general space of pattern matching at the moment, because we don't feel like we have a good understanding of where the language ought to be going. We therefo…
4 Likes