Live data from Hacker News

Overview: What are Cpp2 and cppfront? How do I get and build cppfront?

hsutter.github.io

161–170 of 174 posts

Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?

#161
post #100

Earlier quoted context omitted.

How about Google's Carbon language? https://github.com/carbon-language/carbon-lang

Carbon and Cpp2 are both "C++ successors," broadly speaking. However, they take different approaches in their design: Carbon is a brand-new language that's designed to have seamless interoperability to C++. Cpp2 is C++, just with a different syntax. (The goal is to even be able to mix Cpp2 and C++ syntax in the same source file. The initial implementation transpiles Cpp2 to C++ source code, similar to how the origina…

> Cpp2 is C++, just with a different syntax.

Not really, that is like telling CFront or Objective-C (Stepstone days) were C with a different syntax.

Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?

#162
post #7

Earlier quoted context omitted.

Kotlin is a distinct language with new features that (I'm fairly sure) make it non-isomorphic to Java code though. But I can't speak on the others.

not sure what "(non)-isomorphic" but Kotlin code is interoperable with Java code in both directions. You can easily call Java-code from Kotlin (but I guess that's the easy direction) but you can also call Kotlin code from Java. There exist specific annotations to control how Kotlin code will be converted to bytecode and therefore be invoked from Java, e.g. a function in a Kotlin companion object would normally concer…

Try to call Kotlin co-routines directly from Java to see how it goes.

Or call Java features from Kotlin, that aren't available on Android.

Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?

#163
post #75

Earlier quoted context omitted.

An isomorphism is a structure preserving 1:1 map between two sets or some other pair of structures. While Java and Kotlin are interoperable (because they both target the JVM), they are not isomorphic for precisely the reasons you described. If it was, then you could do round trip machine translation on the syntax in either direction and have a result that's identical to the original. You can't do that because Kotlin…

> Cpp2 isn't trying to be a successor language to C++ Herb is trying to sell it as not a successor because for now that suits him better. Because C++ is a general purpose language Herb can deliver a "not a new feature" that is so elaborate in practice you would never write the equivalent C++ by hand, but Herb can insist that since technically it can still be transpiled to C++ it's not a different language... right up…

Mostly because it would look odd if the WG21 chair, would also sell his language as a C++ successor language, lets not fool ourselves it is something else.

Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?

#164
post #152
post #145

Earlier quoted context omitted.

Not sure what is meant by this statement. Both cpp2 and Carbon are different languages, neither of them claim to be just C++. Both languages will have bidirectional compatibility with C++ so that code written in C++ can be directly accessed from Carbon and code written in Carbon can be directly accessed from C++. Neither of them use an FFI for compatibility.

It's my understanding that Carbon will create wrapper Carbon classes around C++ classes and convert data back and forth between C++ types and Carbon types at the interface boundary when necessary.

Yep, that's the plan.

Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?

#165
post #16

I wonder how this compares with Carbon -> C++ [0]. Carbon is (was?) a fantastic proposal, but not sure if it has lost steam since it was introduced or how well it is being adopted (be it inside Google or outside)? Being able to incrementally/interchangeably use/call existing C++ code (and vice versa) seems like a great design choice (in Carbon) without having to introspect the actual generated code. Not sure how easy…

Carbon isn't "being adopted", it's still being developed. Making a programming language takes time. Let them at least get to a point where they release some form of public beta (i.e a few more years, at least) before talking about adoption.

+100 btw. =D

Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?

#166
post #120

Earlier quoted context omitted.

The authors are required to make it obtuse. They're required to use warts on all of the names because most of the code is in the head files and is generative code compiled by users of the library rather than the vendor. In order to avoid naming conflicts they can only use obscured names in their implementation of any but the defined API (eg. naming any internal functions, macros, or variables with leading underscores…

They could supply a "pretty" version for people who want to review it. Every time I have to step through code (and accidentally step into STL code) it looks sloppy and gross, like a swamp. No comments or organization. I would expect something neatly formatted, and comments saying "This is overload-4 of std::copy()..." etc.

Professional software developers have a lot to do just to get their job done on time and within budget. Having to duplicate all their code just so that people who contribute nothing to the end product can have an easy time understanding it is just never going to be a priority worth addressing.

The problem here is not really the code, it's the reader.

Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?

#167

Earlier quoted context omitted.

Ignoring the fact that WG21 is not a single person or entity, but 200 people with disjoint interests, your whole argument doesn't make sense. std::set preserves sorted as an invariant, so there is no such precondition on its lower_bound member. The important requirement for std::set is that the comparison function satisfies a strict weak ordering. Again, the behaviour is undefined if it does not. There is no substitu…

> Ignoring the fact that WG21 is not a single person or entity, but 200 people with disjoint interests, your whole argument doesn't make sense. How did you get the idea that I mistakenly believed WG21 is a "single person or entity"? > There is no substitute for correctness. You need to satisfy the requirements or stuff doesn't work. Whether the "doesn't work" means an error, a crash, corrupt memory, resource leaks or…

> How did you get the idea that I mistakenly believed WG21 is a "single person or entity"?

> > classic WG21 choice

> This is how WG21 ended up here. Programmers who believe that it just "doesn't really make much of a difference". Except, it turns out that everybody else can tell the difference

C++ is a practical language for practical programmers solving real problems. Language purists or Rust zealots will be happier elsewhere.

Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?

#168
post #127

Earlier quoted context omitted.

But you can do that with fmtlib/std::format as well when you provide formatting for custom types, that just becomes: fmt::println("Player is at {}", _player_pos);

Should be possible to implement cout more effectively since there is no string parsing. I say “should” because in practice it seems to be the other way around. I don’t know why.

There are some fundamental reasons why cout is slower than stdio/{fmt}: https://stackoverflow.com/a/65325727/471164.

Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?

#169

Earlier quoted context omitted.

> Ignoring the fact that WG21 is not a single person or entity, but 200 people with disjoint interests, your whole argument doesn't make sense. How did you get the idea that I mistakenly believed WG21 is a "single person or entity"? > There is no substitute for correctness. You need to satisfy the requirements or stuff doesn't work. Whether the "doesn't work" means an error, a crash, corrupt memory, resource leaks or…

> How did you get the idea that I mistakenly believed WG21 is a "single person or entity"? > > classic WG21 choice > This is how WG21 ended up here. Programmers who believe that it just "doesn't really make much of a difference". Except, it turns out that everybody else can tell the difference C++ is a practical language for practical programmers solving real problems. Language purists or Rust zealots will be happier…

> classic WG21 choice

So if I said that "Uniting and Strengthening America by Providing Appropriate Tools Required to Intercept and Obstruct Terrorism" act is a classic naming choice by the US Congress your understanding would be that I've mistaken the Congress for a "single person or entity" ? Even though in reality this stupid habit (ridiculous acronyms in the titles of legislation) is indeed a hallmark of American law making and not of some imaginary single person ? I guess I can't help you.

WG21 may consist of dozens of people, but the character of its decisions is a reflection of the larger body, not somehow merely a reflection of those individuals. To my mind ISO's process is tremendously ill-suited to the work of developing programming languages, and while JTC1 itself makes sense, neither SC22 nor the various working groups are a good way to develop these languages.

> C++ is a practical language for practical programmers solving real problems. Language purists or Rust zealots will be happier elsewhere.

The problem with this characterization as a "Practical" language is that the user community do not want your "solutions" any more being as how you think it just "doesn't really make much of a difference" what happens to them when, inevitably, you are less than perfect.

That's not very practical at all.

Re: Overview: What are Cpp2 and cppfront? How do I get and build cppfront?

#170
post #166

Earlier quoted context omitted.

They could supply a "pretty" version for people who want to review it. Every time I have to step through code (and accidentally step into STL code) it looks sloppy and gross, like a swamp. No comments or organization. I would expect something neatly formatted, and comments saying "This is overload-4 of std::copy()..." etc.

Professional software developers have a lot to do just to get their job done on time and within budget. Having to duplicate all their code just so that people who contribute nothing to the end product can have an easy time understanding it is just never going to be a priority worth addressing. The problem here is not really the code, it's the reader.

Who says they have to duplicate it? Just write the original version clean, clearly, and concisely. Then run it through a mangler to rename variables to avoid collisions.

The STL is maintained by volunteers, it's a FOSS project. So your appeal to Serious Business doesn't hold.

Post reply on HN