What does HackerNews think of cppfront?

A personal experimental C++ Syntax 2 -> Syntax 1 compiler

Language: C++

Heck, even C++ is getting out of hand for Herb Sutter. He might say "ISO C++ is the best tool in the world today to write the programs I want and need", but then he also says "My goal (with cppfront) is to explore whether there's a way we can evolve C++ itself to become 10x simpler, safer, and more toolable."

https://github.com/hsutter/cppfront

Have you looked at the CppFront[1] project by Herb Sutter? It's less of a completely new language like Carbon. It's meant to be C++ with a "nicer" syntax, while providing 100% linking compatibility, and with 100% source backward compatibility available when desired.

[1] https://github.com/hsutter/cppfront

I had the same vibes with Herb Sutter's cppfront. It offers full source compatibility by introducing a new syntax that can be mixed freely with the traditional syntax. Seems like it's actively being worked on here https://github.com/hsutter/cppfront.

I've not looked at Circle in depth. Do you or anyone else have a perspective on how they compare?

True. Stroustrup's first implementation Cfront [1] was a C++ to C translator:

> Cfront was the original compiler for C++ (then known as "C with Classes") from around 1983, which converted C++ to C; developed by Bjarne Stroustrup at AT&T Bell Labs. The preprocessor did not understand all of the language and much of the code was written via translations.

cppfront [2] aims to do the same for translating C++ to C++:

> Cppfront is an experimental compiler from a potential C++ 'syntax 2' (Cpp2) to today's 'syntax 1' (Cpp1), to learn some things, prove out some concepts, and share some ideas.

[1] https://en.wikipedia.org/wiki/Cfront

[2] https://github.com/hsutter/cppfront

> New languages get to distill what works, and incorporate the lessons into their design directly - starting fresh, without the complexity baggage.

I think that may be the motivation for Sutter's work on cpp2.

https://github.com/hsutter/cppfront

Herb is working on something like that already. See his work on CppFront as an alternative syntax for C++: https://github.com/hsutter/cppfront
> - := for assignment is similar enough to what is used in math for definition, so that languages like Pascal use it

I think its cppfront that is taking the approach of `:=` being a declaration with the type being inferred (ie shorthand for `: Type =`). Reading up on that has made me the most ok with applying this to functions (which I see coming up more these days) but I think i still prefer functions having a more distinct look as I process them differently when reading. Now, cppfront's approach to types I think is bonkers, making critical details hard to find except maybe through convention.

https://github.com/hsutter/cppfront

> <> for inequality is something SQL got right

Maybe I'm not recognizing the biases of my own learning background but this never reads right to me vs "not equal" / `!=`.

> - concise keywords like `fn`

In other discussions, it sounded like Graydon had an upper limit of 4 characters for keywords

https://www.reddit.com/r/rust/comments/13oemrg/question_abou...

For me, I had a "whoosh" moment for `fn` and always thought it a weird abbreviation, completely overlooking "fn" keys on laptops.

Indeed. New versions never break the old. Every new feature has to account for interactions with the rest of the language.

Herb Sutter's https://github.com/hsutter/cppfront could be a good strategy to clean it up.

There have been a lot of recent development around a "simpler c++". I think google carbon ( https://github.com/carbon-language/carbon-lang) and hurb sutter (https://github.com/hsutter/cppfront) are probably the most advanced "proposal". Both languages are highly experimental and really far away from being production ready if ever.

If you want/need something today, Dlang is pretty good.

There are also a lot of other languages such Rust/Zig etc... which "somewhat" fit in the same niche as C++ but tend to have very different programming philosophy.

Edit : Can't believe i left out Dlang, the OG better/simpler c++

> frontend to C++ that cleans up the syntax, has much stricter rules around UB, and can rely on C++ as its unsafe counterpart

You're looking for Herb Sutter's CppFront: https://github.com/hsutter/cppfront

As Cfront was to C, Cppfront is to C++.

> Do you know that in MSVC uint16_t(50000) + uin16_t(50000) == -1794967296?

That problematic value is produced by multiplication (*), not addition (+). It happens because uint16_t is unsigned short, and all arithmetic must be promoted to at least rank int.

The easiest universal fix for proper signed/unsigned arithmetic promotion is: (0U + uint16_t(50000)) * uint16_t(50000). See https://stackoverflow.com/questions/39964651/is-masking-befo...

> And suddenly it turns out that all the “C++ killers”, even these which I wholeheartedly love and respect like Rust, Julia, and D, do not address the problem of the XXI century. They are still stuck in the XX.

You forgot to mention Carbon ( https://en.wikipedia.org/wiki/Carbon_(programming_language) ) and cppfront ( https://github.com/hsutter/cppfront ).

Unfortunately, it's also C++ code. Most of the weakest parts of C++ come from its close association with C.

When asking why some people like Rust over C++, I think not enough weight is given here: Rust got to not worry about decades of legacy C stuff seeping in. If Rust isn't your jam -- and I get why it wouldn't be -- there are some initiatives starting now from within the C++ community to shed the C legacy with a new language that feels a lot more like modern C++. Herb Sutter's cppfront[0] and Carbon[1] are examples.

But I don't think it makes sense to dismiss this criticism just because the author happens to like Rust. These C idioms continue to be valid and reasonably widely used in C++.

[0]: https://github.com/hsutter/cppfront [1]: https://github.com/carbon-language/carbon-lang

I agree that ideally everything should be written in safer alternatives, in most scenarios is not feasible to migrate from C++ to another language, because of the code base size.

I think cppfront[0] is the way to go if you want to write a safer language on top of C++, you can watch the talk about it here[1].

[0] https://github.com/hsutter/cppfront [1] https://www.youtube.com/watch?v=ELeZAKCN4tY

Fizzled out means just that, if you check C++ mailings, nothing happened since 2019.

Doesn't matter, because it was made public Herb Sutter's presented his own language as solution to fix C++ at this year's CppCon,

https://github.com/hsutter/cppfront