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

-7

u/ShakaUVM i+++ ++i+i[arr] Sep 17 '22

Does rewriting C++ to look like Rust make it as safe as Rust? Why not leave the syntax alone? I don't like return values after functions.

5

u/Xirema Sep 17 '22

A lot of newer languages seem to prefer the return type coming after the function declaration. I suspect some people believe it's better for newer programmers.

Whether or not that's true I don't know, but as someone who has a project that's written in C++ and Angular (Typescript), I will say that a lot of the typescript code tends to look cleaner aesthetically than the C++ does. Granted, the C++ is usually doing much more complicated things.

34

u/bigcheesegs Tooling Study Group (SG15) Chair | Clang dev Sep 17 '22

The reason basically every new language does this is to make parsing simpler. This was extensively discussed on /r/cpp when Carbon was announced.

-5

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

The reason basically every new language does this is to make parsing simpler.

Because it's obviously more important for it to be easy for computers to understand the code than for humans...

→ More replies (4)