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

Meta jared771 at gmail.com
Mon Nov 1 18:38:05 UTC 2021


On Monday, 1 November 2021 at 08:15:55 UTC, Araq wrote:
> On Monday, 1 November 2021 at 00:20:33 UTC, Andrei Alexandrescu 
> wrote:
>> I think it's relevant to our recent discussion on versioning, 
>> and also for its considerations on language design.
>>
>> https://youtube.com/watch?v=raB_289NxBk
>>
>> P.S. Destruction comes at https://youtu.be/raB_289NxBk?t=4727 
>> :o)
>
> What? Pattern matching doesn't scale/nest well because you 
> think it's like try-catch? That's major news to all C#, F#, ML, 
> Ocaml, Rust, Swift, Elixir programmers...

Andrei is perfectly correct on this IMO, and it's telling that 
both you and Herb dodged the complaint in the exact same way by 
invoking an argument from authority (or maybe analogy?) - "Well 
these other successful languages do it so it must be okay".

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".

Not that I'm ascribing any intentional malice or desire to ignore 
Andrei's complaint to Herb's reponse, but I think he dismissed it 
a little too easily given that even in my own personal 
experience, writing nested match (and nested try-catch) 
statements is ugly, messy, and an enormous pain that really 
limits how often I reach for them.

That being said, I am a huge proponent of more "syntactically 
light" pattern matching features in a language as they can really 
make for some concise and powerful code.


More information about the Digitalmars-d mailing list