hsutter / cppfront

A personal experimental C++ Syntax 2 -> Syntax 1 compiler
Other
5.24k stars 223 forks source link

[SUGGESTION] Composition in Pattern Matching #981

Open AbhinavK00 opened 4 months ago

AbhinavK00 commented 4 months ago

In response to P2688, Pattern Matching discussion for Kona 2022, it was specified after a poll that WG21 committee prefers composition of patterns instead of chaining.Since then, there have been further discussions about pattern matching but none too progressive.

In february committee mailing, P2688R1 was yet another pattern matching proposal with support for pattern compostion. Since cpp2 aims to have same designs for future features (as evident through syntax change of contracts), it is only natural that cpp2 supports pattern compostion in one way or the other. While I have no concrete design proposal, this suggestion is simply given to spark a discussion. The finalised design could even be integrated into P2392 and presented as next revision along with any changes that Herb finds appropriate.

Alternatives considered: Stay with status quo and wait until pattern matching is added to cpp for any further changes, which could be C++26 or even C++29.