I started learning C++ as my first programming language, but I also studied SML and Scala among others. I was shocked when Michael said that "about more than half the room" raised their hand, knowing the concept of pattern matching. Shouldn't the attendees at Cppcon be more familiar with programming paradigms in general? I loved the talk and hope this integrates well in C++. How efficient would the variant type selection be compared to overloading and visiting?
[.value:0, .next: *? [.value:0]] - this is compilable Perl, i don't even want to read this code. I can, but I don't want to. I would rather expect pattern matching to make code more readable, not less readable.
You should be able to use the dereferencing pattern with recursive pattern matching to make a pretty succinct finite state machine, and I suspect that this is exactly what they did in CTRE.
There I was liking this : Sutter th-cam.com/video/ARYP83yNAWk/w-d-xo.html (Fix things)... so I so hoped std::variant would go away... Features presented would be nice for a library but that wouldn't work to generate/compile code.. still feel ambiguous about having it in the language
why inspect instead of "with"? with constexpr { as pattern : stmt; as pattern: stmt; ... } would hint to what's going on to both Python-minded and Pascal-minded people. And that a wide spectrum of people. And shorter "with" and "as" would make nesting less cumbersome.
I started learning C++ as my first programming language, but I also studied SML and Scala among others. I was shocked when Michael said that "about more than half the room" raised their hand, knowing the concept of pattern matching. Shouldn't the attendees at Cppcon be more familiar with programming paradigms in general? I loved the talk and hope this integrates well in C++.
How efficient would the variant type selection be compared to overloading and visiting?
[.value:0, .next: *? [.value:0]] - this is compilable Perl, i don't even want to read this code. I can, but I don't want to. I would rather expect pattern matching to make code more readable, not less readable.
I think this really makes it worse, I would rather use if-else clause in this case...
You should be able to use the dereferencing pattern with recursive pattern matching to make a pretty succinct finite state machine, and I suspect that this is exactly what they did in CTRE.
It seems like coroutines offer a cleaner and simpler way to code state machines?
What are the chances to get this one in C++20? Are there any obstacles of getting this one into standard?
C++20 has been feature frozen; it is *possible* to get this in C++23; but it's more likely to do be accepted into C++26 or C++29 etc.
No, it's too late C++20 is already here.
There I was liking this : Sutter th-cam.com/video/ARYP83yNAWk/w-d-xo.html (Fix things)... so I so hoped std::variant would go away... Features presented would be nice for a library but that wouldn't work to generate/compile code.. still feel ambiguous about having it in the language
why inspect instead of "with"?
with constexpr {
as pattern : stmt;
as pattern: stmt; ...
}
would hint to what's going on to both Python-minded and Pascal-minded people. And that a wide spectrum of people. And shorter "with" and "as" would make nesting less cumbersome.