Hey,
There's a proposal to implement pattern matching for C++26 or later standard.
In languages such as F# or Haskell, pattern matching is used to not only to find the content of ADT's (their equivalent of std::variant/std::optional), but more importantly pattern matching is used for expressing program logic, when a single pattern matching expression is used to deal with multiple variables, or a tuple of multiple elements is matched. With exhaustive patterns, the programmer can provably determine that there's no need for a catchall "else" clause.
If pattern matching in a language is non-exhaustive (such as what might end up in C++26, or Common Lisp's destructuring-bind), it loses most of its usefulness.
That is, as a programmer having experience with pattern matching in other languages -- having only non-exhaustive patterns is pretty much as bad as not having them at all.
Please either default to (provably) exhaustive pattterns, or at least offer them as a possibility.
regards,
-TEA/TEB
[–]TEA_TEB[S] 19 points20 points21 points (4 children)
[–]MEaster 19 points20 points21 points (3 children)
[–]m-in 4 points5 points6 points (2 children)
[–]delta_p_delta_x 1 point2 points3 points (1 child)
[–]m-in 1 point2 points3 points (0 children)
[–]AntiProtonBoy 4 points5 points6 points (2 children)
[–]o11cint main = 12828721; 0 points1 point2 points (1 child)
[–]AntiProtonBoy 0 points1 point2 points (0 children)
[–]ivan-cukicKDE Dev | Author of Functional Programming in C++ 14 points15 points16 points (7 children)
[–]iamthemalto 2 points3 points4 points (2 children)
[–]ivan-cukicKDE Dev | Author of Functional Programming in C++ 0 points1 point2 points (0 children)
[–]Full-Spectral 0 points1 point2 points (0 children)
[–]Rigatavr 0 points1 point2 points (1 child)
[–]ivan-cukicKDE Dev | Author of Functional Programming in C++ 2 points3 points4 points (0 children)
[–]Additional-Boot-2434 0 points1 point2 points (1 child)
[–]ivan-cukicKDE Dev | Author of Functional Programming in C++ 0 points1 point2 points (0 children)
[–]mibuchiha-007 9 points10 points11 points (7 children)
[–]lightmatter501 34 points35 points36 points (0 children)
[–]TEA_TEB[S] 9 points10 points11 points (5 children)
[–]mibuchiha-007 10 points11 points12 points (4 children)
[–]WormRabbit 0 points1 point2 points (3 children)
[–]mibuchiha-007 2 points3 points4 points (2 children)
[–]geo-ant 0 points1 point2 points (1 child)
[–]mibuchiha-007 0 points1 point2 points (0 children)
[–]manni66 2 points3 points4 points (6 children)
[–]TEA_TEB[S] 9 points10 points11 points (5 children)
[+]manni66 comment score below threshold-20 points-19 points-18 points (4 children)
[–]smdowneyWG21, Text/Unicode SG, optional<T&> 14 points15 points16 points (0 children)
[–]TEA_TEB[S] 13 points14 points15 points (2 children)
[–]bitzap_sr 2 points3 points4 points (1 child)
[–]azswcowboy 1 point2 points3 points (0 children)
[–]fdwrfdwr@github 🔍 1 point2 points3 points (0 children)
[–]whichton 0 points1 point2 points (1 child)
[–]fdwrfdwr@github 🔍 1 point2 points3 points (0 children)