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.
Google Launches Carbon, an Experimental Replacement for C++
221–230 of 243 posts
Re: Google Launches Carbon, an Experimental Replacement for C++
#222Earlier 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.
Re: Google Launches Carbon, an Experimental Replacement for C++
#223Earlier 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?
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++
#224While 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.
Re: Google Launches Carbon, an Experimental Replacement for C++
#225Earlier 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.
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++
#226How 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…
Re: Google Launches Carbon, an Experimental Replacement for C++
#227Speaking 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?
Re: Google Launches Carbon, an Experimental Replacement for C++
#228It’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?
Re: Google Launches Carbon, an Experimental Replacement for C++
#229I 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++
#230How 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.