Live data from Hacker News

Google Launches Carbon, an Experimental Replacement for C++

thenewstack.io

221–230 of 243 posts

Re: Google Launches Carbon, an Experimental Replacement for C++

#221
post #91
post #70

Earlier quoted context omitted.

knowing neither of these languages i’d rather it be labeled something more clear as neither one of those screams immutable to me. the immutable variant should use the ‘const’ keyword instead.

Const variables are traditionally initialized at compiled time. In Swift, let may be initialized at runtime and then becomes immutable.

that’s just a choice by the language designer. nothing prohibits initialization at runtime.

Re: Google Launches Carbon, an Experimental Replacement for C++

#222
post #70

Earlier quoted context omitted.

knowing neither of these languages i’d rather it be labeled something more clear as neither one of those screams immutable to me. the immutable variant should use the ‘const’ keyword instead.

Well Nim also has `const` the difference is that `const` must be evaluated in compile time, but `let` is just to prevent reassignments, more info: https://nim-lang.org/docs/tut1.html#constants which is different than what JavaScript does.

3 people now saying the same thing. const is not required to be interpreted at compile time, these are choices made by language designers. and read the code with ‘let’ in it like it’s english, does let actually describe constnenss using its english definition? no. i’d argue that any language using ‘let’ for const values is borderline too theoretical. hell, even “define” is better than “let”

Re: Google Launches Carbon, an Experimental Replacement for C++

#223
post #172

Earlier quoted context omitted.

Swift isn't bad, and I actually enjoyed using it. What I didn't enjoy was XCode, which is a shame because they're basically inseparable.

I love Swift. And Xcode 14 is great! What don't you like about it?

This might be difficult to communicate, but I feel like XCode has me spending way more time and clicks on window/pane management than other IDEs. Apple's design philosophy is to keep things minimalist and hide controls which are not in active use. This means I find myself going back to click on small buttons in order to bring up a pane that will finally allow me to just to click on one icon I need to perform some task. Whereas in other IDEs can I force an icon to stay visible and spend much less time traversing the application's UI.

For an analogy, imagine using a workbench and being forced to put each tool back into it's respective drawer once I am done using it - even though I will certainly need to use the tool again very soon. Whereas other IDEs let my workbench be as customized and cluttered as I want it to be.

Re: Google Launches Carbon, an Experimental Replacement for C++

#224

While I have not had time to check this out, more generally whenever I read “Google launches…” I wonder how long until it makes it into the ever-growing graveyard? [1] https://killedbygoogle.com/ [2] https://gcemetery.co/

On one hand, fair point. OTOH, last I heard, golang is still very much alive.

Surprisingly flutter, angular.

Re: Google Launches Carbon, an Experimental Replacement for C++

#225
post #203

Earlier quoted context omitted.

Rather than enforcing the style guide ( https://google.github.io/styleguide/cppguide.html ) through code reviews and code review tools, the language itself encourages the developer to write better code than they would have if writing C++. The Google C++ style guide is longer than the Carbon language design (though I will note a large number of sections that are "TODO"). (working from guesswork here) Given the codebas…

It’s likely smaller than the style guide because it was just introduced. Either way that’s such a loose comparison. I’m aware a language that enforces better coding styles is more efficient, I’m asking how and why does Carbon do this.

It has been a long time since I did work in C++, and I recall a number of foot-guns in the language.

Reading the design document for Carbon and looking at the samples, it appears that many of these are not as easy to access.

Things such as "not using the preprocessor for meta programming" by itself is a significant advantage.

Re: Google Launches Carbon, an Experimental Replacement for C++

#226

How to make your replacement for a C language Google-able: name it after an API for a C language: Carbon was one of two primary C-based application programming interfaces (APIs) developed by Apple for the macOS (formerly Mac OS X and OS X) operating system. Compare also keywords or key terms: Carbon will be built on a foundation on modern programming principles, including a generics system, that would remove the need…

[deleted]

Re: Google Launches Carbon, an Experimental Replacement for C++

#227

Speaking not from direct experience, having barely touched C++ in the past and never touched D yet, but I've read many paint it as the natural successor, so why not D?

Is D safe like Rust? I don't believe it is. I've written a little D and I like it but we need safe languages. The industry ignored the safety of Pascal, Modula-2, and Ada back in the 1970's and chose C because it was slightly faster. Now we're getting hacked left, right and center and have a huge base of C and C++. Sigh.

Re: Google Launches Carbon, an Experimental Replacement for C++

#228
post #2

It’s clear that the value promise of Carbon is to make it attractive to port existing C++ applications to it. But how this is accomplished, article does not go into detail in this. Is there going to be ABI compatibility with C++? What are the features that make Carbon a better porting target than Rust?

Rust is closer to the the type of languages we need to move to but Carbon makes it easier to port away from existing C++ software. If it's a new project, use Rust if you can. Use Carbon if you need to deal with C++. Rust can interoperate with C++ but with more difficulty.

Re: Google Launches Carbon, an Experimental Replacement for C++

#229
Not a C++ programmer, but I'd like to ask: Are Carbon's goals for interop here sufficient for most libraries and frameworks, or will bridge code be required in most cases?

I see this about exceptions, for instance:

"Carbon may not provide seamless interoperability support for C++ exceptions. For example, translating C++ exceptions to or from Carbon errors might require annotations or bridge code, and those translations may have some performance overhead or lose information. Furthermore, if Carbon code calls a C++ function without suitable annotations or bridging, and that function exits with an exception, the program might terminate."

https://github.com/carbon-language/carbon-lang/blob/trunk/do...

Re: Google Launches Carbon, an Experimental Replacement for C++

#230

How fast are the compile speeds compared to C++? If Carbon can convert existing C++ code, still be human readable and have way faster compile speeds, then yeah it can kill C++. I think I’ll wait couple more years before trying though.

Very slow right now but it's still in beta so it is not at all indicative of the compilation speed it will ultimately achieve.
Post reply on HN