C++ pattern matching is coming

Paulo Pinto pjmlp at progtools.org
Sun Oct 23 11:13:11 UTC 2022


On Sunday, 23 October 2022 at 10:43:40 UTC, IGotD- wrote:
> On Sunday, 23 October 2022 at 00:12:32 UTC, ryuukk_ wrote:
>>
>> One issue with C++'s take is they will reserve 2 more keywords 
>> (choice, match), i think it is a huge mistake, enum and switch 
>> should have been reused imo
>>
>
> Can they reuse switch? In Swift they have pattern matching but 
> they use the switch keyword for their jack-of-all-trades switch 
> statement. Problem with C++ (and D) is that the switch 
> statement is fallthrough by default. In order to fix this 
> historical mistake they need a complete new keyword.
>
> This is something to fix in D3, remove fallthrogh by default.

Java and C# have reused switch, by exchanging the order from 
"switch (var)" into "var switch".


More information about the Digitalmars-d mailing list