Herb Sutter's CppCon talk "Extending and Simplifying C++: Thoughts on Pattern Matching using `is` and `as`"

deadalnix deadalnix at gmail.com
Mon Nov 1 21:31:47 UTC 2021


On Monday, 1 November 2021 at 18:38:05 UTC, Meta wrote:
> Herb goes one further and dismisses Andrei's rebuttal - that 
> even if these other languages use pattern matching 
> successfully, C++ does a lot of things differently and thus the 
> (fallacious IMO) argument that other languages do this doesn't 
> really hold up - with a pretty weak "we'll have to wait and see 
> how it goes".
>

I don't think Herb dodged.

It is right to look at what is successful in other languages. The 
fact something is successful in so many languages is a data point 
that cannot, and shouldn't, be ignored.

However, Andrei is right when he point that there is a category 
of use case, typically in generic code, that is not well served 
by current mechanisms. This is not a problem in most language 
because C++ (and D), differs significantly in their approach 
there.

You'll note that there are example in Herb's presentation that 
are also not well served by current D constructs, notably 
cascading match clauses. They ends up being done with very 
repetitive and error prone template constraints in D.


More information about the Digitalmars-d mailing list