cppfront (Herb Sutter's idea in CppCon)

XavierAP n3minis-git at yahoo.es
Mon Nov 14 13:57:34 UTC 2022


On Sunday, 13 November 2022 at 22:07:41 UTC, norm wrote:
>
> and the Rust marketing machine cogs turn once more...Rust did 
> not invent that syntax yet people now see it and think of Rust.
>
> I think this approach can work for C++. I really like C++ (post 
> C++17) and want to see it improve, same as I really like D and 
> would love to see it take off.

It looks to me that (competing against) Rust must be the reason 
why this syntax is chosen. I didn't say and I didn't think Rust 
invented it -- though I don't really know where it comes from 
originally, or how to call it. Disclaimer: I don't use Rust.

It occurs to me the syntax may make it easier for cppfront to 
identify parts of the code that it needs to compile and others to 
leave alone. In any case requiring it to handle mixed source with 
cpp and cpp2 in the same file, as it does now for the few 
features it supports, sounds really challenging in the long term.

Otherwise as I said, choosing this syntax looks to me very 
questionable, and likelier to push people away from C++ than 
attract them. Not to mention pushing away existing C++ 
programmers. It's like admitting defeat, that C-like syntax is 
worse.

Of course you want to automate and get rid of const auto & const 
overloads, copy-move Hell etc, this is a different topic and the 
main benefit that Herb seems to be going after. But as for 
teaching C++ programmers to declare name: type = instead of type 
name = etc, is it a good idea? While at the same time claiming 
that this is meant so that the generated cpp can still be read 
and maintained on its own if necessary.

Anyway other than the syntax, I'm also curious if this approach 
can work, both in the short and the long terms. If you follow the 
logic, comparing this, as Herb does, to the first C++ compiler by 
Bjarne S which was a trans-compiler to C, then the mixed C/C++ 
period, until the time when C and C++ have become completely 
separate languages, is this the success that Herb would be going 
after in the best of cases, to create a new, different language 
(and one that looks so different)?


More information about the Digitalmars-d mailing list