C++ pattern matching is coming

Paul Backus snarwin at gmail.com
Sun Oct 23 01:02:16 UTC 2022


On Sunday, 23 October 2022 at 00:12:32 UTC, ryuukk_ wrote:
> Pattern matching is mentioned in the D vision document (other 
> section) [1], but is missing in the project board [2]
>
> Is it still planned or it was mentioned as "what's possible 
> next"?

My prediction: if Walter gets bored of ImportC and decides to 
make pattern matching his next project, we'll get it. If he 
doesn't, we won't.

I am less optimistic about built-in sum types. The DMD frontend 
is not really designed to accomodate adding an entire new 
category of types to D's type system. I would not be surprised if 
someone *tries* to add them, but it will probably take multiple 
years for them to go from "initial implementation" to "usable in 
production code".

(Case in point: `noreturn` is basically the simplest possible 
extension to the type system you could make. Over 1.5 years since 
[its initial implementation][1], it is still riddled with bugs 
and unusable in practice.)

[1]: https://github.com/dlang/dmd/pull/12214


More information about the Digitalmars-d mailing list