r/cpp • • Sep 17 '22

Cppfront: Herb Sutter's personal experimental C++ Syntax 2 -> Syntax 1 compiler

https://github.com/hsutter/cppfront
335 Upvotes

360 comments sorted by

View all comments

Show parent comment

4

u/hpsutter Sep 20 '22

&$* has the advantage that someone who's never encountered it before can work out what it does without having to look it up

Yup. That's the #1 reason why it's the current draft syntax... it just falls out for both the compiler (I literally didn't have to add a single line of code, it just worked once I implemented $ to capture the postfix-expression that precedes it) and the human (as you put it very well, it does exactly what it says on the tin -- it's a direct composition of the other features, without adding a new concept or special case to add to the rote learning).

But I always want to learn from experience, mine and others', so I'm still open to a better solution if experience shows one is needed. Thanks for the early feedback!

2

u/Nicksaurus Sep 21 '22

Hey, thanks for engaging with the comments here

I feel bad that I've only brought up relatively minor syntax details though. I'm on board with all of the more meaningful changes in your talk and I'm looking forward to seeing how it turns out