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 comments

7

u/SkoomaDentist Antimodern C++, Embedded, Audio Sep 17 '22 edited Sep 17 '22

I will never understand why people who design a language with the explicit intention of it being a C++ replacement go out of their way to explicitly make the syntax nothing like the C family of languages.

If I wanted to program in a language that looks like a functional language, I'd have switched years ago.

17

u/[deleted] Sep 17 '22

This language needs to coexist with regular C++ code in the same file. Hence, the C++2 syntax needs to be different so the compiler knows whether to transform it or to leave it alone.

-2

u/SkoomaDentist Antimodern C++, Embedded, Audio Sep 17 '22

Would you claim that, say, Java or C# syntax is identical to C++? If not, why would a C++ replacement have to take a completely different approach to fit that requirement?

7

u/[deleted] Sep 17 '22

When you're parsing Java or C#, you don't have C++ functions sprinkled around in the same file.

But if you're parsing C++2 and it has regular C++ in it, you need a way to know what is what.

→ More replies (7)