News for hackers. Stuff that matters.
Re:Carbon Language: An experimental successor to C++ by cogman10 on Tuesday July 19, 2022 @10:57AM (#32152425)
If you are like me and wondering "What makes carbon different from Rust or Zig?

    1. The ability to interoperate with a wide variety of code, such as classes/structs and templates, not just free functions.

    2. A willingness to expose the idioms of C++ into Carbon code, and the other way around, when necessary to maximize performance of the interoperability layer.

    3. The use of wrappers and generic programming, including templates, to minimize or eliminate runtime overhead.
In otherwords, what carbon can do that Rust can't do, is take a C++ class with a `foo` method and call that method. Or create a class with a `foo` method and call that method from C++. Probably one of the biggest hurdles to get over in C++ interopt. Most don't do that, instead you'd make a C function binding and struct and move data/invoke functions through that.
Re:Carbon Language: An experimental successor to C++ by WalterBright on Tuesday July 19, 2022 @01:49PM (#32155388)
Which is what D can do. D can (and does) interact successfully with C++ classes and member functions. Even templates!
Re:Carbon Language: An experimental successor to C++ by WalterBright on Tuesday July 19, 2022 @04:41PM (#32157670)
D has also taken a big step forward in being able to directly import C code. You can do things like:

    import stdio;
and it will compile stdio.h with the builtin C compiler, making all the declarations in it available to your D code.
Re:Carbon Language: An experimental successor to C++ by LorenDB on Tuesday July 19, 2022 @02:37PM (#32156039)
Honestly, the only thing lacking with D (for me) is the lack of good support from Qt (which I think is something Qt should tackle by making the moc multilingual). But I agree with Walter. D already did what Carbon is trying to do, but the syntax is easy enough to pick up in a weekend.
Re:Carbon Language: An experimental successor to C++ by jcelerier on Tuesday July 19, 2022 @03:46PM (#32156968)
> Honestly, the only thing lacking with D (for me) is the lack of good support from Qt (which I think is something Qt should tackle by making the moc multilingual)

it's possible to do Qt without moc even in C++ with https://github.com/woboq/verdigris/, why wouldn't it be possible from D ? it should be even easier considering that D traits allow reflection of member and function names, etc.

Re:Carbon Language: An experimental successor to C++ by arinlen on Tuesday July 19, 2022 @04:50PM (#32157780)
> it's possible to do Qt without moc even in C++ with https://github.com/woboq/verdigris/, why wouldn't it be possible from D ?

You're talking about an entirely different thing. While OP was referring to the current state of D's ecosystem and the impact that missing key frameworks have on hindering adoption, you're arguing about the theoretical possibility of writing a framework with a language, which really does not address OP's point.

Re:Carbon Language: An experimental successor to C++ by detaro on Tuesday July 19, 2022 @04:54PM (#32157828)
No, you are misunderstanding their point. If the problem of using Qt from D is that you need the MOC, then the fact that you can work around the need for MOC and use Qt without it seems quite relevant?
Re:Carbon Language: An experimental successor to C++ by chc on Tuesday July 19, 2022 @06:06PM (#32158601)
The initial complaint was that it did not have "good support." I think it is fair to say that having to spend a significant amount of effort to work around a lack of support is not "good support."
Re:Carbon Language: An experimental successor to C++ by LorenDB on Tuesday July 19, 2022 @09:33PM (#32160247)
Indeed, that is what I meant. I would like to see Qt allow some sort of language-abstracted moc so I can just install Qt and a set of Qt bindings and then use them. Just because I can work around the moc doesn't mean that I can easily and productively use Qt from D.
Re:Carbon Language: An experimental successor to C++ by jcelerier on Wednesday July 20, 2022 @03:26AM (#32162596)
But .. how would that work ? What does "language-abstracted" means for something which is specifically about a language ?

E.g. moc in c++ looks for your classes with a Q_OBJECT macro to generate the matching reflection & metaobject data in a .cpp: how does that work in a language that doesn't have preprocessor macros, or maybe even classes, e.g. Scheme or some BASIC dialect ? In addition, moc is only necessary for languages that do not have proper reflection & code generation facilities - if they do, it's entirely unnecessary as the metaobject code can just be generated in-language as part of the bindings you're mentioning. E.g. consider the python Qt bindings: they don't need a moc. Same for D.

Re:Carbon Language: An experimental successor to C++ by varajelle on Tuesday July 19, 2022 @04:44PM (#32157705)
It is possible, but nobody did it.
Re:Carbon Language: An experimental successor to C++ by kinjalkishor on Tuesday July 19, 2022 @04:00PM (#32157148)
dlang would have been a very serious contender to C++ had it been fully nogc, stable & lean. Also dlang unnecessarily suffered low adoption in start due to competing stdlibs, trying to be both Java & C++ at once.
Re:Carbon Language: An experimental successor to C++ by kinjalkishor on Tuesday July 19, 2022 @04:01PM (#32157158)
I am still a big fan of both dlang & pascal & very hopeful of dlang's Bright future ahead.
Re:Carbon Language: An experimental successor to C++ by vintagedave on Wednesday July 20, 2022 @11:30AM (#32167209)
+1 to Pascal here! Underrated language.
Re:Carbon Language: An experimental successor to C++ by WalterBright on Tuesday July 19, 2022 @04:39PM (#32157645)
If you use the @nogc attribute, D is fully nogc.
Re:Carbon Language: An experimental successor to C++ by kinjalkishor on Tuesday July 19, 2022 @05:08PM (#32158005)
Yes it is very useful addition. Hopefully stdlib will also be fully nogc soon. Of all available options I am most hopeful of dlang. While it doesn't still have taken off it still is improving a lot & has high chances of increased usage. (Python also took years).
Re:Carbon Language: An experimental successor to C++ by WalterBright on Tuesday July 19, 2022 @05:48PM (#32158423)
It doesn't need to be fully nogc. Not using the parts that use the gc will cripple nothing. You'll know which ones use the gc because they won't compile with @nogc.
Re:Carbon Language: An experimental successor to C++ by dymk on Wednesday July 20, 2022 @12:01AM (#32161272)
@nogc is fine, if you're okay with not being able to use large swaths of the standard library, and by extension, most popular D libraries.
Re:Carbon Language: An experimental successor to C++ by WalterBright on Wednesday July 20, 2022 @04:03AM (#32162823)
Not much of the library is dependent on the GC. For example, only one of the algorithms is.
Re:Carbon Language: An experimental successor to C++ by skl131313 on Wednesday July 20, 2022 @11:06AM (#32166820)
There's no "nogc" containers in phobos, or allocators, or an idiomatic way to do safe manual memory management. It expects you to do it the C way. It's also impossible to implement some things because of how D does moving. There's a DIP in the works to change how moving works, but it's overly complicated and bound to introduce even more bugs. https://github.com/dlang/DIPs/blob/master/DIPs/DIP1040.md
Re:Carbon Language: An experimental successor to C++ by kinjalkishor on Tuesday July 19, 2022 @05:10PM (#32158024)
Yes I use @nogc on main itself, to catch all gc usage.
Re:Carbon Language: An experimental successor to C++ by mhh__ on Tuesday July 19, 2022 @05:15PM (#32158081)
Most C++ codebases would be exactly the same with or without a GC. Probably 90% of collective programmer-intuition about memory allocation is either completely wrong or from thinking about a scaling to a point that most products don't get anywhere near.
Re:Carbon Language: An experimental successor to C++ by dymk on Wednesday July 20, 2022 @12:01AM (#32161277)
Probably not, or they'd just be written in Java.
Re:Carbon Language: An experimental successor to C++ by mhh__ on Wednesday July 20, 2022 @12:26AM (#32161405)
There is more to performance than allocating memory. In fact some very performance-centric codebases do use a GC like unreal engine.

On the subject of games it always makes me chuckle when I see people complaining about garbage collection but then having 20 calls to malloc in their hot loop. All memory allocation is slow and not necessarily bounded.

I have written code that uses SoA, cache aware metaprogramming, inline asm, SIMD etc, with a GC because I knew I didn't need to allocate often.

On the subject of Java, I'm no fan of it but lots of projects would probably be fine - probably not quite as fast, but not horrifically so. On hackernews we only discuss extremely careful or expertly written code whereas in real life a lot people use C++ because it's what they got hammered into them at university 20 years ago as the fast language.

For example a lot of engineering and finance codebases are written in a very bad style of C++ code that would be improved by not having the programmers worry about memory too much - infrastructural code is more subtle, but most code serves a direct purpose like implementing some model. In these cases memory allocation is merely a means to an end rather than part of some grand strategy (i.e. it's not like writing a library)

Re:Carbon Language: An experimental successor to C++ by skl131313 on Wednesday July 20, 2022 @11:13AM (#32166905)
I love when people bring up that UE has a GC, if it was written in Java, do you think they would have built a GC on top of Java's GC?

I guess it depends on the GC at that point, 20 mallocs isn't a lot but like the GC in D, it pauses all threads to do it's collection when you allocate. There's also a few games that use C# that have a really bad stutter because of the GC. There's nothing they can do about that though.

Re:Carbon Language: An experimental successor to C++ by dataangel on Wednesday July 20, 2022 @10:54AM (#32166615)
Unreal Engine mostly uses GC for game world objects. Only C++ classes that inherit from a special base class and opt-in are subject to GC. If they used GC for everything the performance would be much worse.
Re:Carbon Language: An experimental successor to C++ by mhh__ on Wednesday July 20, 2022 @12:04PM (#32167746)
Sure, but I'm saying that most C++ code in the wild is probably firmly in the former category.
Re:Carbon Language: An experimental successor to C++ by skl131313 on Wednesday July 20, 2022 @11:15AM (#32166942)
D doesn't do it very well. Carbon doesn't require you to write your own interface. There's also problems with extern(C++) not correctly generating the appropriate assembly. Lots of ABI bugs as it's rolling it's own implementation instead of using LLVM.
Re:Carbon Language: An experimental successor to C++ by Sebb767 on Tuesday July 19, 2022 @11:49AM (#32153351)
The syntax looks a lot like Rust, though. I'm surprised they made such a break when there explicit goal is to make migration from C++ as easy as possible. Also, Rust (from my biased point of view) is currently on its way to become the standard low-level language, so I'm not too confident that Rust-but-with-OO is enough of a selling point.
Re:Carbon Language: An experimental successor to C++ by usrusr on Tuesday July 19, 2022 @12:11PM (#32153818)
Considering the seemingly endless list of things that deliberately don't break with the c++ legacy, new syntax is almost the only change left. And if you were about to give c++ a syntax reboot, why wouldn't you look at what successful other modern syntaxes are doing? "c++, but in a syntax for people accustomed to rust instead of in a syntax for people accustomed to C" sounds like a perfectly reasonable approach.

Your perception (and mine) that rust is about to become the new default for "true native" is perfectly consistent with this, a language for the rust generation for when they have to deal with the c++ legacy. A legacy that won't be going away any time soon. I suspect that the author (authors?) wouldn't disagree at all with "use Rust when possible, Carbon when you can't", my perception (from a quick glance at the site) is that they are fully aware of the limitations of the niche they have so clearly staked out.

Re:Carbon Language: An experimental successor to C++ by kllrnohj on Tuesday July 19, 2022 @01:25PM (#32155034)
> I suspect that the author (authors?) wouldn't disagree at all with "use Rust when possible, Carbon when you can't"

That is in fact explicitly stated on the Carbon introduction:

"Existing modern languages already provide an excellent developer experience: Go, Swift, Kotlin, Rust, and many more. Developers that can use one of these existing languages should."

Re:Carbon Language: An experimental successor to C++ by nextaccountic on Wednesday July 20, 2022 @12:13AM (#32161339)
Also on their FAQ https://github.com/carbon-language/carbon-lang/blob/trunk/do...

> If you can use Rust, ignore Carbon

> If you want to use Rust, and it is technically and economically viable for your project, you should use Rust. In fact, if you can use Rust or any other established programming language, you should. Carbon is for organizations and projects that heavily depend on C++; for example, projects that have a lot of C++ code or use many third-party C++ libraries.

Re:Carbon Language: An experimental successor to C++ by mempko on Tuesday July 19, 2022 @12:30PM (#32154145)
The problem with C++ is it keeps getting better. There was a time when Rust was interesting to me but then C++11 came out. Then they kept improving it
Re:Carbon Language: An experimental successor to C++ by fsloth on Tuesday July 19, 2022 @12:45PM (#32154400)
Regarding C++. IMHO - it’s not getting intrinsically better. More complex. Easy things become a bit less verbose, but the hardest things remain as hard and the compiler is as unhelpful as before.

I agree C++11 and it’s successors are sugaring the language to be a lot nicer but fundamentally nothing has changed.

Rust is fundamentally better in it’s compiler warnings (they are actually helpful), and contains specific solutions to the things that are hard and bite you in C++.

C++ is not going away and it’s my main professional language but Rust does have features that are better.

Re:Carbon Language: An experimental successor to C++ by spacechild1 on Tuesday July 19, 2022 @02:40PM (#32156077)
> but fundamentally nothing has changed.

IMO, move semantics and lambda functions have fundamentally changed the way we write C++.

Also, let's not forget that C++11 introduced a formal memory model with cross-platform atomic operations and multi-threading primitives.

Re:Carbon Language: An experimental successor to C++ by plonk on Tuesday July 19, 2022 @03:07PM (#32156430)
Fundamentally, it has smart pointers and std::make_unique now, which means I never have to touch a raw pointer in most of my code. They can even be adapted to wrap Win32 objects. That's a huge improvement and I don't mind using C++ for new projects now.
Re:Carbon Language: An experimental successor to C++ by sudosysgen on Tuesday July 19, 2022 @12:59PM (#32154663)
In my experience compiler error messages have gotten hugely better, except for template issues which are still very verbose. Especially with clang.
Re:Carbon Language: An experimental successor to C++ by senkora on Tuesday July 19, 2022 @10:50PM (#32160783)
And template error messages should become much better with concepts in c++20.
Re:Carbon Language: An experimental successor to C++ by fouronnes3 on Tuesday July 19, 2022 @12:34PM (#32154208)
C++ has virtually zero tooling and the committee is not interested in ever working on that. Comparing CMake to cargo is like comparing fifth century fireworks to the Space Shuttle. I mean we are getting modules that aren't literally copy paste maybe next year.
Re:Carbon Language: An experimental successor to C++ by StillBored on Tuesday July 19, 2022 @02:36PM (#32156028)
"C++ has virtually zero tooling"

I read that and I was like WTF, the entire programming ecosystem exists on C/C++ tooling. But from your perspective its modules/cargo that is the tooling?

That is IMHO an odd viewpoint. As someone who despises the way cargo works, and hates not having long term explicit control over my dependencies (going so far as to track and check them in along with build artifacts) I'm not convinced that the recent toss another random dependency that itself pulls dependencies into the build is a good thing.

I like the fact that I have three dozen+ different ways to do regexp's in C depending on my priorities, and that picking one requires cognitive overhead and modifications to source control/etc. Its easy to add a line to a makefile/etc to pull crap off github in C, so its not like this is a hard problem to deal with in C/C++ but its one where the scale of the problem allows for optimization. AKA like the dynamic typing argument, making the programmer think about a problem I believe yields a better solution.

Its also one where i'm not tied to the whimsy of the library author should I decide to fork or maintain the code long after they have gotten bored or rewritten it 3 different times. I can to this day rebuild code I wrote 20 years ago on a modern machine with little effort. Can you say the same about even 10 year old node.js or python code?

Put another way, I spend a little bit more on upfront effort and it pays off long term. And I know i'm in the minority, but its also why repeatedly I've run small teams of a half dozen or so people who's products are ahead of major competitors with teams of 100's+ of engineers.

Re:Carbon Language: An experimental successor to C++ by boardwaalk on Tuesday July 19, 2022 @03:18PM (#32156591)
You can do things the way you do them in C++ in Rust if you want. You could `cargo vendor`, you could fork a repo & depend on a specific commit, etc. It’s up to you have the self-control to do that though and not just shovel random dependencies into your project, that’s all.

Mostly you seem to be complaining that it’s just to add dependencies? (maybe put a ‘sleep’ in your bash prompt or something?) and maybe that the Rust ecosystem doesn’t have as many duplicate libraries as C++? (of course it doesn’t?)

Re:Carbon Language: An experimental successor to C++ by StillBored on Tuesday July 19, 2022 @03:57PM (#32157105)
The problem is that cargo gets in the way (as does rustc) if you try and use it in anything other than the simple import this dependency mode. I spent a hell hole of a day or two, trying to pick up a dependency outside cargo because it didn't behave in a way that meshed with the rest of my build environment.

So, yes it handles a couple of the basic cases, but then your out of luck, stuck in a version hell/etc because rustc and cargo are so tightly integrated and the flags needed to emulate some of the behavior with just the compiler are poorly documented and/or version dependent.

It dictates, you conform (which is basically the rust way).

Re:Carbon Language: An experimental successor to C++ by germandiago on Tuesday July 19, 2022 @04:41PM (#32157674)
The problem with the typical rants about C++ is that you guys are outdated.

With Conan you can consume over 1,000 packages directly from build systems and with way more control than what Cargo seems to offer. Take a look. I did use it for a while and compared to 15 years ago things are way better now.

Re:Carbon Language: An experimental successor to C++ by flohofwoe on Wednesday July 20, 2022 @01:54AM (#32161955)
The problem isn't that Conan exists, but that other competing solutions are just as popular which results in fragmentation (for instance vcpkg, and cmake can also directly pull in external dependencies now). In the Rust world there's just Cargo.
Re:Carbon Language: An experimental successor to C++ by pjmlp on Wednesday July 20, 2022 @04:08AM (#32162854)
Not really, Android and Fuchsia have their own cargo replacements, that fit better on their OS SDKs.

Either that, or we get a box of surprises in each build.rs script.

Re:Carbon Language: An experimental successor to C++ by Asm2D on Wednesday July 20, 2022 @04:13AM (#32162880)
Competing solutions are great for innovation.
Re:Carbon Language: An experimental successor to C++ by woodruffw on Wednesday July 20, 2022 @08:39AM (#32164899)
In the world of build systems, I think most people want a little more consistency and a little less innovation. Sometimes a tool should just do its job and broadly resemble other tools in the space.
Re:Carbon Language: An experimental successor to C++ by gkbrk on Wednesday July 20, 2022 @01:27PM (#32169174)
> In the Rust world there's just Cargo.

While not nearly as popular as Cargo (due to being blessed by the core team), Rust still has multiple build tools and package managers.

Re:Carbon Language: An experimental successor to C++ by germandiago on Wednesday July 20, 2022 @05:19AM (#32163272)
Fragmentation is not the problem. The future of C++ is to have metadata exchange, at least the way I see it.

This means that packages can be compiled with any build system, the one that fits you better. In the event that you cannot find a binary that fits you, your package manager can compile on the fly. There are also solutions to keep binary artifacts in Conan. This means that most of the time you can consume pre-made packages in vcpkg/Conan for casual consumption but you can still have binary repositories with fully customized builds for all your permutations of compilers and systems and debug/release. Do not forget this is a hard problem, we are talking to compilation to native, sometimes you need full speed and a custom compilation, not about portable Java bytecode.

But you can still set up and tweak recipes in Conan and upload to your binary repository (what we do at my company).

However, none of these things tie you to a build system, since conan can generate .pc, .cmake, MSBuild, XCode and way more metadata to consume those packages.

You can scale from simple to fully customized. For example before we had a libcxx that we compiled ourselves and pointed all deps and patched packages and could build something with like twenty-some dependencies with that customized libcxx optimized for us. Can you do that with Cargo? Serious question, I did not make extensive use of it.

However for simple uses you can just drop a conanfile.txt and conan install your profile and start to consume your packages. All of this works with CMake, but if I want to use Meson build system or SCons, Make and others I can do it as well. Look at the generators page: https://docs.conan.io/en/latest/reference/generators.html

I do not think fragmentation in build systems is even a real problem anymore because the "not fragmented but simple" philosophy leaves many things out of the box, such as compiling something custom when you really need it.

The system is very flexible. True that the learning curve is harder at first, but much simpler than it used to be in the past.

I can have full projects, not even with Conan, just with simple Meson wraps (Meson wraps are source-only dependencies though) pointing interdependencies to the same version of a library with a very reasonable amount of work: sometimes a single switch in the options, sometimes a small patch that you can keep in your subprojects/ directory or somewhere else.

I can easily generate .cmake and .pc files from Meson itself without trouble, which are two of the most used build systems. But if on top of that you build a Conan recipe then you can have many consumers of your packages for free.

It is nice to have a tool that is more ore less streamlined sometimes, but build systems is a difficult topic and probably there are some that do a few things better than others: cross-compilation, linux tweaks, generating VS solutions for you if your company uses VS, XCode or whatever. It is not bad to have a choice as long as you can interchange.

I would say it is even better than having the one-size-fits-all thing and later when you want to go to the real native stuff then you discover that your tool is too basic and cannot switch.

Re:Carbon Language: An experimental successor to C++ by adev_ on Tuesday July 19, 2022 @07:04PM (#32159127)
> C++ has virtually zero tooling and the committee is not interested in ever working on that

This sentence makes no sense at all:

1 - Tooling does not stop to the build systems

2 - The tooling set in C++ (and C) has been built over decades. It is indeed not a single shiny CLI cargo-style but it several order of magnitude bigger and more powerful than anything you will ever find in any other programming language: memtracers, profilers, thread sanitizers, debuggers, disassemblers, static analyzers, packages managers, bindings generators, ABI checkers, crash analyzers, loggers and I am sure I forget still many others.

Re:Carbon Language: An experimental successor to C++ by fouronnes3 on Wednesday July 20, 2022 @01:28AM (#32161795)
Yeah what I meant was build system tooling, sorry for the approximation.
Re:Carbon Language: An experimental successor to C++ by flohofwoe on Wednesday July 20, 2022 @01:58AM (#32161981)
Most of the tools you mention work below the language level, and thus work automatically for non-C/C++ languages too (or at least LLVM-based languages).
Re:Carbon Language: An experimental successor to C++ by adev_ on Wednesday July 20, 2022 @05:31AM (#32163343)
They do work below the language level but have been generally explicitly made for C and C++ programs. e.g abi-compliance-checker

The other languages benefit of them currently because they leverage LLVM (also made in C++), because their interpreter/VM are made directly in C.

How is it already ? Standing on the shoulders of giants ? :)

Re:Carbon Language: An experimental successor to C++ by germandiago on Wednesday July 20, 2022 @01:03PM (#32168750)
> C++ has virtually zero tooling

CMake, Meson, Waf, Conan, Visual Studio Code, Visual Studio, CLion, Intel VTune, GDB, LLDB, XCode, Artifactory, SonarQube, clang-tidy, clang-format, astyle, Incredibuild...

> Comparing CMake to cargo is like comparing fifth century fireworks to the Space Shuttle

You are wrong here. Cargo serves a set of fixed "this-is-how-to-do-it" thing. In C++ you can build anything. I do not mean it is better, but C++ software already exists and that is the solution that it works better for it. :)

> and the committee is not interested in ever working on that

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p08...

Interoperability effort for modules: https://github.com/GabrielDosReis/ipr

Re:Carbon Language: An experimental successor to C++ by germandiago on Tuesday July 19, 2022 @04:39PM (#32157647)
Besides having lsp (language server protocol), Visual C++, CLion and others, I have been successfully using CMake/Meson paired with Conan and I can tell from experience that it is amazing what you can achieve.

Someone will say Cargo or whatever, which is nice and simple. But with these tools you can choose all details and optimizations as well, something that other tools just hide. But you can still keep it simple with a conanfile.txt for your dependencies and the stock add_executable etc. in CMake/Meson and get done with it. If you feel CMake is subpar (bc its syntax and DSL are terrible, I agree with that) then you can use Meson. It works pretty well.

Re:Carbon Language: An experimental successor to C++ by pjmlp on Tuesday July 19, 2022 @01:01PM (#32154697)
Use Visual C++ and you will have modules today.

I have cargo today in C++ via NuGET and vcpkg, and what is great about it, I don't have to compile my depedencies from scratch.

Re:Carbon Language: An experimental successor to C++ by joshuamorton on Tuesday July 19, 2022 @01:08PM (#32154789)
> I have cargo today in C++ via NuGET and vcpkg, and what is great about it, I don't have to compile my depedencies from scratch.

To be fair, if you're using a language that has a reasonable compilation story, this is only every a concern the first time you compile.

Re:Carbon Language: An experimental successor to C++ by pjmlp on Tuesday July 19, 2022 @01:10PM (#32154816)
Sure I always need an excuse to go out for lunch.
Re:Carbon Language: An experimental successor to C++ by mbrodersen on Tuesday July 19, 2022 @10:04PM (#32160479)
Hahaha you have zero clue. C++ has the best tooling in the world. From static analysers to best in class debuggers to best in class performance profiling tools etc. No other language comes even close.
Re:Carbon Language: An experimental successor to C++ by int_19h on Monday July 25, 2022 @02:28PM (#32228777)
Java has far more extensive tooling in all the categories that you've mentioned. I don't know if it's "the best tooling in the world", but if I had to make an educated guess, I'd bet on Java - and I don't even like it as a language.
Re:Carbon Language: An experimental successor to C++ by flohofwoe on Wednesday July 20, 2022 @02:01AM (#32162006)
Most of the tools you mention are actually language agnostic (debuggers and profilers). And static analyzers are much more important for C and C++ than other languages.
Re:Carbon Language: An experimental successor to C++ by AnimalMuppet on Tuesday July 19, 2022 @01:00PM (#32154690)
Given that gunpowder was invented in the 9th century, fifth century fireworks were probably pretty uninteresting...
Re:Carbon Language: An experimental successor to C++ by raydev on Tuesday July 19, 2022 @01:00PM (#32154682)
It's impossible to deny that C++ is improving.

But it's worth investigating what you can do when you aren't tethered to wild inconsistencies and odd behaviors and workarounds because the community is terrified of breaking backcompat.

Re:Carbon Language: An experimental successor to C++ by JoshTriplett on Tuesday July 19, 2022 @02:58PM (#32156307)
C++11 was where C++ lost me, and I went from saying I knew C/C++ to saying I know C.
Re:Carbon Language: An experimental successor to C++ by imron on Tuesday July 19, 2022 @08:13PM (#32159678)
C++14 was what got me in to Rust.

I'm still in the C++ world for work, and have kept reasonably up to date with things to C++17, but I'm sitting here looking at C++20 and wondering is it really worth the effort...

Re:Carbon Language: An experimental successor to C++ by a9h74j on Tuesday July 19, 2022 @09:56PM (#32160424)
Precisely.
Re:Carbon Language: An experimental successor to C++ by gpderetta on Tuesday July 19, 2022 @12:48PM (#32154460)
Doesn't C++11 precede rust?
Re:Carbon Language: An experimental successor to C++ by tialaramex on Tuesday July 19, 2022 @03:03PM (#32156386)
Rust 1.0 is 2015. Hence this is sometimes referred to as "2015 edition" in Rust's edition system.

But the sort of people who are here to tell you about how great C++ is will say well, actually Rust existed all the way back to 2006 as Graydon's personal project. There were no numbered releases until Rust 0.1 (after C++ 11) and modern features like Traits don't appear until much later, but sure, in this sense Rust existed in 2006.

Re:Carbon Language: An experimental successor to C++ by avrionov on Tuesday July 19, 2022 @01:11PM (#32154834)
I had the same question as you so I checked. C++ 11 standard was released in 2011 of course. Rust development started in 2006 and Mozilla announced it officially in 2010.
Re:Carbon Language: An experimental successor to C++ by arinlen on Tuesday July 19, 2022 @02:20PM (#32155845)
> C++ 11 standard was released in 2011 of course. Rust development started in 2006 and Mozilla announced it officially in 2010.

Given that c++0x was a decade in the making, by that measuring stick the answer is yes, C++11 does precede Rust.

Re:Carbon Language: An experimental successor to C++ by bzxcvbn on Tuesday July 19, 2022 @02:55PM (#32156267)
It's a bit weird to take the release date for one, and the start of the development for the other. By that measure, the first pre-alpha (!) release of Rust was in 2012; the first stable release in 2015. On the other hand, the first RFC for C++0x was in 2008.
Re:Carbon Language: An experimental successor to C++ by grimfang4 on Tuesday July 19, 2022 @12:56PM (#32154620)
Almost. C++0x did, but C++11 doesn't and some compilers/IDEs (e.g. VS) didn't implement full support for C++11 for years.
Re:Carbon Language: An experimental successor to C++ by imron on Tuesday July 19, 2022 @11:10PM (#32160922)
> The problem with C++ is it keeps getting better

This is debatable.

It keeps getting more complex. Whether all the additions are worthwhile remains to be seen.

Re:Carbon Language: An experimental successor to C++ by jcelerier on Wednesday July 20, 2022 @06:47AM (#32163844)
every successive C++ standard allows me to remove a lot of code which is a net benefit
Re:Carbon Language: An experimental successor to C++ by mihaigalos on Tuesday July 19, 2022 @12:54PM (#32154590)
As far as I'm concerned, C++ is there for legacy purposes only.

There are some nice frameworks and tools using it, sure. Yes, you are required to learn it if you are studying CS.

Any serious new development today is done using more modern languages such as Rust (i.e.: the linkerd service mesh proxy [1] for encrypted pod communication in a k8s cluster).

As even the Linux kernel is slowly transitioning to using Rust [2], it's only a matter of time before an inflection point is reached and it goes mainstream (if not already.)

[1] https://github.com/linkerd/linkerd2-proxy

[2] https://hackaday.com/2022/05/17/things-are-getting-rusty-in-...

Re:Carbon Language: An experimental successor to C++ by mbrodersen on Tuesday July 19, 2022 @10:09PM (#32160514)
Hahaha wow. There are more than 5 million C++ programmers out there. Starting new C++ projects every day. I am pretty sure more new C++ projects are started every day than Rust projects. Everything (including Rust) runs on top of browsers/operating systems/drivers/compilers/VMs written in C/C++. Rust code is like a drop in the ocean compared. Maybe in 30 years that will changed? Don’t count on it.
Re:Carbon Language: An experimental successor to C++ by pjmlp on Tuesday July 19, 2022 @12:59PM (#32154660)
Just learned that LLVM, GCC, CUDA, HPC, HFT and the whole games industry aren't serious new development.
Re:Carbon Language: An experimental successor to C++ by mihaigalos on Tuesday July 19, 2022 @01:05PM (#32154752)
.. is it new development?
Re:Carbon Language: An experimental successor to C++ by pjmlp on Tuesday July 19, 2022 @01:11PM (#32154835)
I guess, unless you're into retro-gaming.
Re:Carbon Language: An experimental successor to C++ by maccard on Tuesday July 19, 2022 @02:33PM (#32155982)
To be fair, parts of my work codebase are touching on 25 years old, and I work for a startup from 2020. The codebases we're building on have roots in the mid 90s, and the platforms they run on didn't support modern C++ standards for a very long time after that.
Re:Carbon Language: An experimental successor to C++ by Jensson on Tuesday July 19, 2022 @03:23PM (#32156650)
So anything including "windows.h" isn't really new development then? Sounds like a strange definition.

I'd say that there is a lot of new projects being started with C++, still way more than there are new projects in Rust, at least if you only count serious ones.

Re:Carbon Language: An experimental successor to C++ by Nullabillity on Wednesday July 20, 2022 @07:51AM (#32164387)
GCC is from the 80s, Unreal and Source are both from the 90s, and LLVM and CUDA are from the 2000s.

Yeah, I'd call all of those codebases pretty old at this point.

Re:Carbon Language: An experimental successor to C++ by xoac on Tuesday July 19, 2022 @02:36PM (#32156026)
I mean a lot of these things rely on copying old code. AFAIK a lot of new games in bigger studios start by essentially copying the old engine into a new tree.
Re:Carbon Language: An experimental successor to C++ by mbrodersen on Tuesday July 19, 2022 @10:10PM (#32160527)
Nope. Ex. game developer here. New C++ projects and libraries are started every single day.
Re:Carbon Language: An experimental successor to C++ by mihaigalos on Tuesday July 19, 2022 @01:13PM (#32154865)
> I guess, unless you're into retro-gaming.

So new (same-)old development then?

Re:Carbon Language: An experimental successor to C++ by otabdeveloper4 on Tuesday July 19, 2022 @02:03PM (#32155608)
> Any serious new development today is done using more modern languages such as Rust

Uhm, no. Sorry, thanks for playing, try again.

Re:Carbon Language: An experimental successor to C++ by femtogram on Tuesday July 19, 2022 @04:38PM (#32157632)
robotics is primarily c++ and python. that may change to being rust and python, but it will definitely take some time.
Re:Carbon Language: An experimental successor to C++ by fancyfredbot on Tuesday July 19, 2022 @01:30PM (#32155089)
My impression as a CS grad is that very few computer science courses require you to learn C++.
Re:Carbon Language: An experimental successor to C++ by femtogram on Tuesday July 19, 2022 @04:40PM (#32157662)
what languages you learn at university highly depends on the specific school you are at, the professors, and which companies are donating the most money. it's certainly not a great representation of what is going on in the industry as a whole.
Re:Carbon Language: An experimental successor to C++ by xigoi on Tuesday July 19, 2022 @03:02PM (#32156370)
I'm studying Mathematical Informatics and we have C++ as the first language.
Re:Carbon Language: An experimental successor to C++ by germandiago on Tuesday July 19, 2022 @04:46PM (#32157732)
My impression is that C++ is used in the real world though. :)
Re:Carbon Language: An experimental successor to C++ by fancyfredbot on Thursday July 21, 2022 @08:41AM (#32178607)
Yes that is true but I'm responding to the up stream comment saying "you are required to learn it if you are studying CS". There is a common perception that computer science degrees are about learning things like C++ but my experience is that most emphasise more abstract skills like data structures, algorithms, complexity, formal program design, etc.
Re:Carbon Language: An experimental successor to C++ by germandiago on Thursday July 21, 2022 @03:15PM (#32183596)
Not at all. Computer science and engineering (I think this is different degrees in US but in Spain it was a BS + Master when I studied) is about algorithms, data structures, big O notation complexity in algorihtms, client/server architecture, hardware and assembly, understanding all the underlying math, networking, even HPC and advanced data structures when you keep choosing specialized subjects, but not learning a single tool for the sake of it for programming.

In fact, it is the least relevant part when you are studying. You learn tools better after you end the degree IMHO.

Re:Carbon Language: An experimental successor to C++ by tempest_ on Tuesday July 19, 2022 @03:39PM (#32156876)
It really depends on what bit of computer science you are learning.

C++ is definitely past its prime and has been surpassed in many areas by other languages but there are still a bunch of domains where it is the primary language.

Re:Carbon Language: An experimental successor to C++ by mbrodersen on Tuesday July 19, 2022 @10:13PM (#32160544)
How about almost all domains? Everything in the world runs on top of browsers/operating systems/drivers/VMs/networks/embedded systems etc. that are written in C/C++. Not to mention that the tools used to design chips and manufacture them are also written in C/C++. No other language comes even close.
Re:Carbon Language: An experimental successor to C++ by moltonel3x on Thursday July 21, 2022 @07:39AM (#32178168)
Having C or C++ somewhere in the lower levels of your stack doesn't make them the primary language for your domain. Other wise CPU microcode would be the primary language of every domain.
Re:Carbon Language: An experimental successor to C++ by ncmncm on Thursday July 21, 2022 @06:54AM (#32177834)
In fact there is plenty that can be expressed only in C++. A person making effective use of the power of the language finds anything else a huge step down.

Anyone not having fun when coding C++ is doing it wrong.

Re:Carbon Language: An experimental successor to C++ by jstimpfle on Thursday July 21, 2022 @12:37PM (#32181486)
Example of some well-written code that expresses things that can only be expressed in C++?
Re:Carbon Language: An experimental successor to C++ by sk0g on Saturday July 23, 2022 @11:06PM (#32209938)
I'm far from the most experienced in C++, but friend classes/functions do not seem to have a direct equivalent in any other language.
Re:Carbon Language: An experimental successor to C++ by int_19h on Monday July 25, 2022 @02:35PM (#32228903)
In C#, nested classes are effectively friends with their outer class, and it's used quite often in practice.

On the other end of expressivity, in Eiffel, every class member is declared as visible to specific other classes; if you want something to be public, you say that it's visible to ANY, which is the universal base class similar to e.g. Object in Java.

Re:Carbon Language: An experimental successor to C++ by ncmncm on Thursday July 28, 2022 @12:24AM (#32260471)
NB: Friend-this and -that are not among powerful features of C++.
Re:Carbon Language: An experimental successor to C++ by socialdemocrat on Tuesday July 26, 2022 @10:48AM (#32239066)
Because you don’t need them in other languages.
Re:Carbon Language: An experimental successor to C++ by pron on Tuesday July 19, 2022 @02:38PM (#32156043)
> Rust (from my biased point of view) is currently on its way to become the standard low-level language

The evidence seems to suggest the opposite. Other than a lot of talk on programming fashion publications that are always more aspirational than representative (such as this site) Rust seems to have reached 0.3% of the market [1], up from 0.1% a couple of years ago [2], and while that is ok growth, programming languages with few exception tend to reach, approach, or at least point toward their all-time peak market penetration around age 10, and Rust is already 7. Any language could, of course, be an exception to historical trends, but there's nothing to suggest that is the case.

More anecdotal adoption stories are just as bleak. Even at this relatively advanced age, many companies dabble in Rust — as they did in, say, Haskell — but not many established companies have yet to really bet big on it.

The only positive is that among the low-level languages discussed on aspirational sites, Rust is, indeed, the most talked-about language, but history also suggests that that is a very bad predictor of long-term market success.

[1]: https://www.devjobsscanner.com/blog/top-8-most-demanded-lang...

[2]: https://www.hiringlab.org/2019/11/19/todays-top-tech-skills/

Re:Carbon Language: An experimental successor to C++ by cogman10 on Tuesday July 19, 2022 @03:00PM (#32156331)
> programming languages with few exception tend to reach, approach, or at least point toward their all-time peak market penetration around age 10

Notable exceptions from the links you've provided:

C#, Java, Go, PHP. All appear to have an upward trajectory today.

Javascript has also seen a similar penetration boost when nodejs came on the scene.

With rust looking to get integration both into the Linux kernel and GCC, that points to some pretty positive things for the language's penetration. Particular in the embedded world.

Re:Carbon Language: An experimental successor to C++ by pron on Tuesday July 19, 2022 @03:13PM (#32156525)
> All appear to have an upward trajectory today.

They might have an upward trajectory, but they're not posed to break well beyond their respective records. With the possible exception of Python, how popular a language is at age ten is a reasonable rough indicator of how popular it's ever going to be. At its current growth rate Rust would reach 1% market share at age ten. Again, there can certainly be surprises, but I think it's weird to say that actual current evidence clearly points to success for Rust. On the contrary, to become a success it would need to buck the trend and be quite a surprise. So it could happen, but I don't see much to support the claim that this is what's currently happening.

> With rust looking to get integration both into the Linux kernel and GCC, that points to some pretty positive things for the language's penetration.

I agree that it shows that the language is taken seriously and isn't dismissed as a possible option, and that that's very good. That indicates that the language isn't an immediate irredeemable failure, but I don't think it's an indicator of future success.

Re:Carbon Language: An experimental successor to C++ by cogman10 on Tuesday July 19, 2022 @03:34PM (#32156815)
> That indicates that the language isn't an immediate irredeemable failure, but I don't think it's an indicator of future success.

I'd simply point to the fact that there are very few languages that have tried to get into the same space that rust exists in. Even something like D came with an optional GC which has pulled it out from consideration for things like the kernel or embedded devices.

When you say "most languages are peaked at 10 years" I'd simply point to the fact that rust is substantially different from most languages. It's not tackling the same market spaces. The ones it is hitting have been slow moving for a while now.

Re:Carbon Language: An experimental successor to C++ by pjmlp on Tuesday July 19, 2022 @04:31PM (#32157553)
While others with GC are used without issues on embedded for the last decade when users aren't stuck on ways of the past.

https://www.ptc.com/en/products/developer-tools/perc

https://www.aicas.com/wp/products-services/jamaicavm/

https://www.microej.com/

https://www.astrobe.com/

https://www.wildernesslabs.co/

Ah but that isn't serious enough.

I guess battleship weapons control might be something serious,

https://dl.acm.org/doi/10.1145/2402709.2402699

Re:Carbon Language: An experimental successor to C++ by Jensson on Tuesday July 19, 2022 @04:39PM (#32157649)
Major problem with GC languages is that it is horribly to link against libraries that ships with a GC. Lets say I want to use 10 libraries, if each has their own GC then my program is now running with 10 GC's each trying to optimize itself, which isn't a tenable situation.

So system level libraries has to work without a GC, even though system level programs can work fine with a GC.

Re:Carbon Language: An experimental successor to C++ by jb1991 on Tuesday July 19, 2022 @04:50PM (#32157774)
> then my program is now running with 10 GC's each trying to optimize itself

Is this true with Java? I thought it's a single runtime that manages memory in all the code/libraries in your process.

Re:Carbon Language: An experimental successor to C++ by Jensson on Tuesday July 19, 2022 @04:54PM (#32157834)
For java the virtual machine provides the GC for everything, but then you can only use JVM libraries and not libraries in other languages.

The reason C and C++ libraries can easily be included in basically any other language is that they don't have a GC, so there are no such issues, just call the functions and things works fine.

Re:Carbon Language: An experimental successor to C++ by jb1991 on Tuesday July 19, 2022 @04:56PM (#32157855)
> Major problem with GC languages is that it is horribly to link against libraries that ships with a GC.

I'm curious which GC languages do this. The most popular ones that come to mind for me are anything on the JVM, JS, and Go, and I've never heard anyone point this out about them.

Re:Carbon Language: An experimental successor to C++ by nicoburns on Tuesday July 19, 2022 @07:40PM (#32159412)
Libraries work fine in GC languages if they're written in that language. But you can't easily take a library written in Java and import it into your Python project (you can do it, but it's not efficient, and the more languages you include the less efficient it gets). Whereas libraries written in C/C++/Rust/etc can have binding in every language without issue. Consider libraries like zlib or curl and SQLite that are ubiquitous is across every language ecosystem. Those are the libraries that need (well, greatly benefit) from being written in a non-GC language.
Re:Carbon Language: An experimental successor to C++ by Jensson on Tuesday July 19, 2022 @06:54PM (#32159035)
Every language with a GC has this problem. If you want a library to be used in both Java and Python you don't write it in either Java nor Python, you write it in C++ or another language without a GC and import that to Java and Python. Trying to import a Java library in Python or vice versa is horrible, since GC's are very hard to work with from outside the language ecosystem.
Re:Carbon Language: An experimental successor to C++ by int_19h on Monday July 25, 2022 @02:38PM (#32228959)
I don't know about Java, but it's trivial to import a .NET library in Python with a high-level mapping that takes care of everything GC-related automatically:

http://pythonnet.github.io/

I don't see any reason why something like this cannot exist for Java, if it doesn't already.

Re:Carbon Language: An experimental successor to C++ by lukaslalinsky on Tuesday August 02, 2022 @07:16AM (#32317246)
But this is exactly the point, it is possible, but once you import such library into Python, you are running both Python runtime and .NET runtime, both having their own GC implementations and many other processes.
Re:Carbon Language: An experimental successor to C++ by Jensson on Tuesday July 19, 2022 @04:35PM (#32157607)
But every language needs to get a foothold within its hype period. In a few years the hype for Rust will die down, at that point you wont get new blood unless they are forced to learn it so it will be hard to grow.

Programmers are forced to learn C++ since many jobs require it. Students were forced to learn Python since teachers choose it as a language at universities. You need some reason like this for a language to thrive after its hype cycle is over, and currently there are no such reasons forcing programmers to learn Rust and it doesn't look like there will be any within a few years either.

Re:Carbon Language: An experimental successor to C++ by pron on Wednesday July 20, 2022 @07:39AM (#32164265)
Except I didn't say "most languages are peaked at 10 years"; I said virtually all languages reached or neared the ballpark of their peak at age 10, from the most to the least successful ones, and those include C, C++, and D. I think Python might be the only counterexample. So it's always possible that some other language would be another exception, but there's nothing today to indicate that Rust is gearing to be such an exception or that it is substantially different from all the languages in all domains that have exhibited that behaviour.

I do agree that it's more likely that Rust is an exception than, say, Scala or perhaps even Go, but the same would be true for, say, Carbon. I.e. while the likelihood is higher, there's nothing at the moment that would indicate that's what's happening.

Obviously Rust has garnered more enthusiasm among PL fans than D ever did, and its peak would probably be higher, but technical enthusiasm and hype is very weakly correlated with long-term success in the world of programming languages. Most charitably you could say it's a necessary condition, but it is very clearly not a sufficient one.

Re:Carbon Language: An experimental successor to C++ by ncmncm on Thursday July 21, 2022 @07:03AM (#32177902)
Yes, Python is the only outlier.

Rust very much could still fizzle. If it does, it will be because it failed to change to be adoptable by more users. All existing users are tolerant of niche qualities. If it succeeds, the programmers who already know it will constitute less than 2% of the total, and the 98% will have picked it up after it changed to be more readily taken up.

If it fizzles, current users will always be at least 70% of the total.

So, if you want it to succeed, you will need to welcome the changes that can get it there.

Re:Carbon Language: An experimental successor to C++ by pron on Sunday July 24, 2022 @08:22AM (#32212742)
I think all new languages have some challenges that would make it very hard for them to become as popular as older languages (none of the top five languages is under twenty years old).

For one, we're long since in an era of diminishing returns — new languages have a smaller ROI compared to incumbents than the incumbents had to the languages they replaced — while the cost of a switch is the same if not higher (because codebases are larger). So switching to a new language is just not as profitable today as it was twenty years ago.

For another, the market is more fragmented today than it was, say, 15 years ago. For example, while Java is not the only game in town on the server as it was in, say, 2003-2006, no other single language shows any signs of becoming as dominant as that either. Some use Python for server-side applications, some use JS, some use C#, some use Kotlin, and some use Go. There is no single language that people flock to and so Java is still the dominant server-side language (although for a while PHP seemed like it could be it). So even if Rust does gain actual traction, it's very unlikely to become the standard low-level language. Some may use Rust, some may use Zig, some will use C++, some will use C, and maybe some may use Carbon. The only new language around that seems capable of reaching a popularity similar to ~25 year-old languages is TypeScript.

I also think Rust has a fundamental problem specific to it, and that is that it's a complex, rich, language. Rich/complex languages have never been super-popular, and while C++ is arguably more-or-less as complex as Rust, it wasn't when it gained its market share (only to lose much of it shortly after).

Re:Carbon Language: An experimental successor to C++ by ncmncm on Sunday July 24, 2022 @08:46AM (#32212924)
Yet, C++ regained share by getting more complex.

Language complexity is a poor measure. Better is the complexity of using a language to achieve an aim. C and Pascal are pretty simple as languages, but they make it substantially more complex to complete a task, because they lack the expressive power needed to help any.

C++11 is substantially more complex than C++98, but much simpler to program with. Rust is both simpler than C++ (at surface level, because it leaves behind cruft C++ cannot) but more complex because it makes greater cognitive demands (to satisfy the borrow checker) and also because it lacks powerful features C++ offers. C++ is better able than Rust to package semantics in a library and deliver that to users on command. But Rust is way, way better in that way than C.

Re:Carbon Language: An experimental successor to C++ by N1H1L on Wednesday July 20, 2022 @10:25AM (#32166217)
Yep. In fact Python really started taking off almost 20 years after its' release. People forget that Python turned 31 a few months back.
Re:Carbon Language: An experimental successor to C++ by mtlmtlmtlmtl on Tuesday July 19, 2022 @04:08PM (#32157246)
GP said the standard low-level language. Low-level code will always be a much smaller percentage of all code than the heaps of web apps our industry is shitting out on a daily basis.

Thus it would be completely reasonable for the de facto sysdev language to have a small market share overall(unless like for C/C++ there is a lot of legacy stuff to maintain) . Your sources don't shine any light on this at all.

Re:Carbon Language: An experimental successor to C++ by slingnow on Tuesday July 19, 2022 @04:41PM (#32157671)
You don't think comparing the current defacto standard low-level languages (C/C++) to Rust shines any light on the issue you raised? [1]

C/C++ : 6.17% Rust : 0.29%

This was addressed in one of the linked sources. What would you accept as evidence, then?

1: https://www.devjobsscanner.com/blog/top-8-most-demanded-lang...

Re:Carbon Language: An experimental successor to C++ by moltonel3x on Wednesday July 20, 2022 @10:20AM (#32166130)
Different metrics tell a different story. For example GitHub pull requests [1] are C++: 2.60%, Rust: 2.09%, C: 1.43%, with a clear trend showing Rust ahead of C++ next year. Or you could look at the Stackoverflow survey of languages used among professionals [2], which gives C++: 20.17%, C: 16.7%, Rust: 8.8%, with rust gaining 1-2% each year.

There's no best metric, they're all biased, you need to consider a few different ones. Otherwise you won't notice when you've stumbled upon one with with an extreme view.

Combining C and C++ in language stats is debatable, they should IMHO be measured separately. When grouped as a language category, "C/C++/Rust" is slowly becoming more common.

1: https://tjpalmer.github.io/languish/#y=pulls&names=c%2B%2B%2...

2: https://survey.stackoverflow.co/2022/#most-popular-technolog...

Re:Carbon Language: An experimental successor to C++ by cobalt on Thursday July 21, 2022 @12:42AM (#32175855)
I assume 1 is pulling only from github.com public projects. Many companies A: don't make their code public, B: probably use github enterprise/other hosted solutions (esp including not git based)

2: Also skews towards a certain demographic

Re:Carbon Language: An experimental successor to C++ by moltonel3x on Thursday July 21, 2022 @07:28AM (#32178093)
Yes, public github repos, stackoverflow survey respondents, devjobscanner offers, google searches, etc are all skewed in some way.

It's very hard to qualify the effect of those biases though: for example how does the public/private repo ratio differ between languages ? Good luck giving a trustworthy answer to that. Apart from looking at lots of different source kinds, one thing that's fairly trustworthy is the trend of a specific language in a specific source.

On that topic, looking at the "SO questions" metric of the first link, C and C++ both have a strange regular spike in the last quarter of each year. I attribute that to new CS students flocking to SO at the beginning of their term. Another fun trend to look at is the hourly google searches over a week: the weekdays / workhours spike is much more pronounced for some languages than others.

Re:Carbon Language: An experimental successor to C++ by mtlmtlmtlmtl on Tuesday July 19, 2022 @05:01PM (#32157923)
I think looking only at the number of dev jobs leaves too many potential confounding factors to be useful. For instance, how many C/C++ jobs are actually companies who need those devs to move away from C/C++? What's the overlap? How much of the C/C++ share is maintaining legacy code vs starting new projects? Sure the data says something about it, can we draw any conclusions from it other than precisely the numbers you listed? Not really, not without more detailed data.

One thing I would welcome is specifically looking at new sysdev projects over time and what languages they're in.

To be clear I'm not taking a view on whether Rust will become the standard. I really don't know, and I've yet to see anything convincing me one way or the other.

Re:Carbon Language: An experimental successor to C++ by dmix on Friday July 22, 2022 @02:47PM (#32195686)
Devops and web designer (relatively non-programmer jobs) listings also might list Javascript, Python, and Java, also maybe Ruby for Chef.

And there's a ton of those job listings.

Github repos might be a better source of penetration and use.

Re:Carbon Language: An experimental successor to C++ by pron on Wednesday July 20, 2022 @07:45AM (#32164320)
Sure, but even low-level languages have tended to reach the ballpark of their all-time peak market penetration -- however high or low it is -- around age 10.
Re:Carbon Language: An experimental successor to C++ by mek6800d2 on Tuesday July 19, 2022 @04:08PM (#32157253)
"... around age 10." C++ (not to mention C)? IIRC, I remember seeing B.S.'s "C with Classes" appear in ACM SIGPLAN Notices in the early 1980s -- 40 years ago. I don't think it hit its peak 10 or even 15 years after its early development. Given that it's C++, that's a pretty major exception.
Re:Carbon Language: An experimental successor to C++ by Jensson on Tuesday July 19, 2022 @04:22PM (#32157430)
C++ was huge in the 1990s, C++'s share is probably smaller today than back then since so much of programming has moved over to managed and scripting languages.
Re:Carbon Language: An experimental successor to C++ by pron on Wednesday July 20, 2022 @07:46AM (#32164334)
If C++ hadn't already hit it's all-time peak market share in 1995, it was certainly well inside the ballpark. It's far from an exception.
Re:Carbon Language: An experimental successor to C++ by nemothekid on Tuesday July 19, 2022 @03:38PM (#32156874)
>programming languages with few exception tend to reach, approach, or at least point toward their all-time peak market penetration around age 10

How are you coming to this conclusion? I can think of more counter examples than actual examples (Almost every language on the top 10 aside from PHP where close to peak market penetration at age 10).

Re:Carbon Language: An experimental successor to C++ by nicoburns on Tuesday July 19, 2022 @07:43PM (#32159443)
I think the low-level world moves slower.

Key players like Microsoft and the Linux Kernel developers are only just beginning to pick up Rust. It's been considered promising, but immature for much of it's lifetime, and it's only recently gotten to the point that it's considered mature enough for core infrastructure projects (which are really it's forte) in the last couple of years.

Re:Carbon Language: An experimental successor to C++ by agumonkey on Tuesday July 19, 2022 @03:03PM (#32156375)
I don't think rust is headed to be the norm, but I don't think it should be compared to most mainstream languages. It's not python/php/ruby.. it's a very difficult niche where a lot of efforts failed flat.
Re:Carbon Language: An experimental successor to C++ by zozbot234 on Tuesday July 19, 2022 @11:57AM (#32153546)
> The syntax looks a lot like Rust, though. I'm surprised they made such a break

Convergent evolution. Rusty syntax is pretty close to what you get if you want to make a language look broadly similar to C/C++ while avoiding pathological and/or computationally difficult parsing.

Re:Carbon Language: An experimental successor to C++ by mbrodersen on Tuesday July 19, 2022 @10:01PM (#32160456)
> on its way to become the standard low-level language

It will take a very long time for Rust to get even close to the huge amount of C++ code out there. There are more than 5 million professional C++ developers employed around the world today. And that number is increasing. Don’t get me wrong: I like Rust and other attempts to move beyond C++. But don’t underestimate how much C++ code has been written the last 30+ years. And new C++ projects are started every single day. There are probably more C++ projects started every day than Rust projects. So anything that makes it possible to move beyond C++ while being 100% interoperable is good news.

Re:Carbon Language: An experimental successor to C++ by zozbot234 on Tuesday July 19, 2022 @10:05PM (#32160485)
Carbon is not trying to be 100% interoperable with C++. It's trying for some fuzzy notion of "good enough" - that's really not very different from what Rust is trying to do with cxx-rs. Yes there are serious challenges and I've described them here, but they're not impossible to address while staying with Rust.
Re:Carbon Language: An experimental successor to C++ by lenkite on Wednesday July 20, 2022 @02:22AM (#32162157)
> Carbon is not trying to be 100% interoperable with C++ It's trying for some fuzzy notion of "good enough"

No, it's clearly not a "fuzzy" notion of interop even in the most uncharitable interpretation. Your assertion is mis-information.

"Seamless, bidirectional interoperability with C++, such that a library anywhere in an existing C++ stack can adopt Carbon without porting the rest."

Support mixing Carbon and C++ toolchains

Compatibility with the C++ memory model

Minimize bridge code

Unsurprising mappings between C++ and Carbon types

Allow C++ bridge code in Carbon files

Carbon inheritance from C++ types

Support use of advanced C++ features

Support basic C interoperability

Re:Carbon Language: An experimental successor to C++ by zozbot234 on Wednesday July 20, 2022 @04:24AM (#32162937)
And that's still not 100%. The Carbon devs are very clear that there will be some C++ code that Carbon is unable to interoperate with.
Re:Carbon Language: An experimental successor to C++ by gulbanana on Wednesday July 20, 2022 @08:46AM (#32164964)
Like the standard library - they don't plan to support exceptions.
Re:Carbon Language: An experimental successor to C++ by rkangel on Monday July 25, 2022 @11:04AM (#32225358)
Oh, that's excellent and interesting news - not a fan of exceptions. I'm not sure how that's going to work with interop when libraries rely on exceptions though. Where did you hear about this? I'd love to know more.
Re:Carbon Language: An experimental successor to C++ by google234123 on Friday July 29, 2022 @11:59PM (#32284167)
You will probably have to write more c++ code to handle those exceptions inbetween
Re:Carbon Language: An experimental successor to C++ by imachine1980_ on Tuesday July 19, 2022 @12:04PM (#32153672)
Rust is like c++ but only the new way to doing c++ is huge rust is like subset of c++ and ownership model. I thing is the right way c++ is harder than rust only because is so bloated. Carbon seams less bloated "fork" of c++ whit only the new way of doing things, but allow you full interoperability whit all c++, instead of partial and i don't see ownership, i thing is taxing mentally (worth or not depends). if i work in c++ i totally will use this.
Re:Carbon Language: An experimental successor to C++ by BearOso on Saturday July 23, 2022 @10:16PM (#32209623)
I don't know about it becoming the standard LL language yet. There's a lot of memory management in low level programming, and peppering everything with unsafe seems like it'd be tedious. I'd rather just write in C to begin with.

I'm interested in seeing how things are handled with the Linux kernel's rust support, if it ever becomes more than a proof of concept. That will be a good viability test.

Re:Carbon Language: An experimental successor to C++ by flohofwoe on Tuesday July 19, 2022 @01:30PM (#32155091)
I'd say the syntax looks like most other modern languages, not just Rust.
Re:Carbon Language: An experimental successor to C++ by UncleMeat on Tuesday July 19, 2022 @12:41PM (#32154347)
Syntax migration is easy. It is the semantic migration that is hard.
Re:Carbon Language: An experimental successor to C++ by aaaaaaaaaaab on Tuesday July 19, 2022 @03:48PM (#32156988)
>Also, Rust (from my biased point of view) is currently on its way to become the standard low-level language

Lol. Gave me a good chuckle!

Re:Carbon Language: An experimental successor to C++ by anon25783 on Tuesday July 19, 2022 @01:26PM (#32155051)
looks like Rust mixed with Go
Re:Carbon Language: An experimental successor to C++ by dleslie on Tuesday July 19, 2022 @11:01AM (#32152462)
Interestingly enough, Chicken Scheme has a library that allows for interop with C++ to this degree:

http://wiki.call-cc.org/eggref/5/bind#c-notes

Re:Carbon Language: An experimental successor to C++ by imaltont on Tuesday July 19, 2022 @11:54AM (#32153468)
I believe Clasp has a pretty good C++ interface as well for Common Lisp.
Re:Carbon Language: An experimental successor to C++ by dleslie on Tuesday July 19, 2022 @12:05PM (#32153712)
It looks superior to Chicken's, albeit requiring more initial configuration:

https://clasp-developers.github.io/clbind-doc.html

Re:Carbon Language: An experimental successor to C++ by imaltont on Tuesday July 19, 2022 @12:18PM (#32153939)
Well, they are different languages made for different things. Clasp was specifically made because the author had a bunch of C++ code for his research projects, but wanted something more high level/simpler to implement things in. He landed on Common Lisp but none of the implementations had good C++ interop, so he made his own. Can recommend Christian Schafmeister's (creator of clasp) talks on it, it's interesting stuff. In particular his talk on an LLVM Conference.
Re:Carbon Language: An experimental successor to C++ by zozbot234 on Tuesday July 19, 2022 @11:07AM (#32152562)
Isn't this one of the most prominent features in D? Sounds like they're trying for something very much like D, while starting closer to current C++.
Re:Carbon Language: An experimental successor to C++ by kllrnohj on Tuesday July 19, 2022 @11:42AM (#32153199)
D still requires you to write bindings, see https://dlang.org/spec/cpp_interface.html

Also D objects have a different lifetimes & requirements, which complicates things ( see https://dlang.org/spec/cpp_interface.html#lifetime-managemen... )

Carbon appears to be auto-generating bi-directional bindings, and since it has the same memory model has no such awkward interactions between non-GC'd and GC'd worlds like D does.

Re:Carbon Language: An experimental successor to C++ by KerrAvon on Tuesday July 19, 2022 @01:47PM (#32155355)
Re:Carbon Language: An experimental successor to C++ by zozbot234 on Tuesday July 19, 2022 @11:52AM (#32153448)
> Also D objects have a different lifetimes & requirements, which complicates things

Does Carbon actually solve these issues, though? It would be great if it did, but they don't list complete interop w/ C++ as an actual goal of theirs, only enough to make it practically viable for development.

Re:Carbon Language: An experimental successor to C++ by kllrnohj on Tuesday July 19, 2022 @11:57AM (#32153545)
Carbon's memory model is compatible with C++'s[1], so where would you foresee complications? D could have been so much better here if it just hadn't chosen to be a GC'd language. That single choice pretty much kills any easy interop.

1: "For example, C++ and Carbon will use the same memory model." https://github.com/carbon-language/carbon-lang/tree/trunk/do...

Re:Carbon Language: An experimental successor to C++ by zozbot234 on Tuesday July 19, 2022 @11:59AM (#32153586)
AIUI, you don't need to use D with a garbage collector. It can be disabled.
Re:Carbon Language: An experimental successor to C++ by dymk on Tuesday July 19, 2022 @12:20PM (#32153963)
The D standard library is heavily tied to the GC. If you want to avoid the GC, you'd have to give up the standard library, and if you do that, you have to give up most of the D ecosystem.

As far as I can tell, there hasn't been progress in untying the stdlib from the GC - https://github.com/dlang/projects/issues/56

Re:Carbon Language: An experimental successor to C++ by int_19h on Monday July 25, 2022 @02:42PM (#32229035)
You don't need non-GC stdlib for C++ interop, though.
Re:Carbon Language: An experimental successor to C++ by pjmlp on Tuesday July 19, 2022 @01:03PM (#32154717)
D is always rebooting what they want to be, I no longer think they still stand a chance to be relevant in the next decade.
Re:Carbon Language: An experimental successor to C++ by donkarma on Tuesday July 19, 2022 @11:31AM (#32152977)
D is closer to this than this rust rip-off
Re:Carbon Language: An experimental successor to C++ by Koshkin on Tuesday July 19, 2022 @01:18PM (#32154927)
Yeah, why not D? It's such a good, mature alternative to C++, albeit not widely adopted.
Re:Carbon Language: An experimental successor to C++ by zamalek on Tuesday July 19, 2022 @11:48AM (#32153332)
Like every braces language following C is a C rip-off?

Rusty syntax is objectively superior to almost everything else we've come up with, there's no reason it shouldn't be copied.

Re:Carbon Language: An experimental successor to C++ by nineteen999 on Tuesday July 19, 2022 @12:23PM (#32154018)
> Rusty syntax is objectively superior to almost everything else we've come up with, there's no reason it shouldn't be copied.

You mispelled "subjectively". Rust is a hideous looking language, despite its many other benefits.

Re:Carbon Language: An experimental successor to C++ by Someone on Tuesday July 19, 2022 @12:10PM (#32153789)
If Rusty syntax is objectively superior to almost everything else we've come up with, that almost should make us think before blindly copying it.

So, for those thinking “Rusty syntax is objectively superior to almost everything else we've come up with” (I don’t, if only because I don’t believe the syntax of programming languages can be compared on quality without considering the audience), what syntax do you believe it not objectively superior to?

Re:Carbon Language: An experimental successor to C++ by Joker_vD on Tuesday July 19, 2022 @12:09PM (#32153779)
> is objectively superior

Those objective criteria of superiority being?..

Re:Carbon Language: An experimental successor to C++ by vazgriz on Tuesday July 19, 2022 @12:29PM (#32154130)
It eliminates the Most Vexing Parse.

Consider this C++ code:

  Foo bar();
A programmer could make simple mistake thinking that is declaring a variable of type Foo. Carbon eliminates this by having explicit keywords for variable and function declaration. (This style is much more Rust based than C++)

  fn bar() -> Foo;
  var bar : Foo;
It makes parsing easier for both the users and maintainers of the language.
Re:Carbon Language: An experimental successor to C++ by compiler-guy on Tuesday July 19, 2022 @12:37PM (#32154252)
There are literally thousands of shipping languages that don't have the most vexing parse problem.

If that is Rust's entire syntax advantage, it isn't a very big one.

Re:Carbon Language: An experimental successor to C++ by arinlen on Tuesday July 19, 2022 @02:22PM (#32155876)
> It eliminates the Most Vexing Parse.

C++'s most vexing parse issue ceased to be a concern around a decade ago with the introduction of uniform initialization.

Re:Carbon Language: An experimental successor to C++ by Joker_vD on Tuesday July 19, 2022 @12:35PM (#32154222)
If that's the only criterion then Pascal's syntax, which doesn't have "the most vexing parse" problem either, and for the same reason, is also almost better than anything else.
Re:Carbon Language: An experimental successor to C++ by xigoi on Tuesday July 19, 2022 @03:05PM (#32156410)
So by this logic, pretty much every language other than C++ has “objectively best” syntax.
Re:Carbon Language: An experimental successor to C++ by zamalek on Tuesday July 19, 2022 @06:43PM (#32158945)
long long

Templates

Re:Carbon Language: An experimental successor to C++ by nerdponx on Tuesday July 19, 2022 @01:36PM (#32155199)
I would also wonder about D and Odin, neither of which are particularly successful but both of which are also supposed to be kind of like C++ replacements.
Re:Carbon Language: An experimental successor to C++ by olliej on Tuesday July 19, 2022 @09:12PM (#32160071)
Zig is to my knowledge specifically designed to have they kinds of use after free that C and C++ have. Their claim is not to “hide” allocation by requiring everyone to implement manual retain and release.
Re:Carbon Language: An experimental successor to C++ by pjmlp on Wednesday July 20, 2022 @04:47AM (#32163081)
Zig is at most, as safe as a language like Modula-2.

Definitly safer than C and C++ in regards to bounds checking and numeric conversions, but without any language protection against user after free, other than what you would already get with heap debuggers on C and C++.

Re:Carbon Language: An experimental successor to C++ by goodpoint on Tuesday July 19, 2022 @06:10PM (#32158642)
Nim is even better at that, as it generates C/C++ code natively and compiles it using GCC.
Re:Carbon Language: An experimental successor to C++ by kinjalkishor on Tuesday July 19, 2022 @04:04PM (#32157204)
For once if they would have focused on compile times that would have been a very valid reason to switch.
Re:Carbon Language: An experimental successor to C++ by sebastianconcpt on Tuesday July 19, 2022 @11:10AM (#32152615)
Minus having to deal with memory management?
Re:Carbon Language: An experimental successor to C++ by mrits on Tuesday July 19, 2022 @11:50AM (#32153377)
Designing a language to interop well with a single language is short sighted in my opinion. I want a clean ffi that I know will be able to iterop with Swift, Typescript, C#, C++, C, python etc... In my current project I'm currently using Rust/protobuff to do all of this and it rarely gets in my way of how I want to do things.
Re:Carbon Language: An experimental successor to C++ by compiler-guy on Tuesday July 19, 2022 @12:35PM (#32154227)
The major usecase for Carbon is to advance Google's internal, multi-billion line, C++ codebase.

As nice as a greenfield language with a clean ffi would be, "extremely close ties to C++" is Carbon's primary benefit.

Re:Carbon Language: An experimental successor to C++ by skavi on Tuesday July 19, 2022 @01:16PM (#32154895)
sorry for nitpicking what is likely intentional exaggeration, but multi billion can’t be anywhere near accurate, right?
Re:Carbon Language: An experimental successor to C++ by compiler-guy on Tuesday July 19, 2022 @01:31PM (#32155115)
There are many billions of lines in Google's monorepo[1], summing well over 80 terrabytes of data. The paper below is from 2016, and the repo has only gotten bigger since then.

Exactly how many of them are C++ is not disclosed, as far as I know. But it is public knowledge that C++ is the biggest of Google's primary languages (C++, Java, Go, Python, Javascript, and so on).

https://research.google/pubs/pub45424/

Re:Carbon Language: An experimental successor to C++ by saagarjha on Tuesday July 19, 2022 @01:30PM (#32155090)
No, Google really has that much code. Some of it is probably machine generated but it's definitely in the billions of lines.
Re:Carbon Language: An experimental successor to C++ by summerlight on Tuesday July 19, 2022 @01:27PM (#32155062)
It's a bit of an exaggeration, but it's close. If you count all Google's C++ code base (google3 + open source) it's fairly close to one billion. If you count regardless of language, I believe it's ~3B.
Re:Carbon Language: An experimental successor to C++ by kllrnohj on Tuesday July 19, 2022 @07:38PM (#32159400)
It's funny you list typescript there given typescript itself is a language designed entirely around interop with a single other language.

Kotlin is another such widely liked language that was designed entirely around interop with a different language.

Re:Carbon Language: An experimental successor to C++ by mrits on Wednesday July 20, 2022 @11:00AM (#32166713)
Kotlin took an entirely different approach, one that I agree with. It can easily interact with dozens of other languages because of it.

Typescript is a superset of javascript and intentionally short sighted to fill a current need.

Re:Carbon Language: An experimental successor to C++ by Kranar on Tuesday July 19, 2022 @12:18PM (#32153933)
Many long living languages are those that are source compatible with a single language. C++, Objective-C, TypeScript come to mind.
Re:Carbon Language: An experimental successor to C++ by saagarjha on Tuesday July 19, 2022 @12:14PM (#32153867)
This language has “zero-cost” with C and C++, “minimal cost” with anything else that is compatible with those ABIs, and “moderate cost” with everything else via protobufs :P
Re:Carbon Language: An experimental successor to C++ by wtetzner on Thursday July 21, 2022 @06:57PM (#32186284)
C++ itself was a language designed to interop well with a single language.
Re:Carbon Language: An experimental successor to C++ by formerly_proven on Tuesday July 19, 2022 @12:42PM (#32154354)
> In otherwords, what carbon can do that Rust can't do, is take a C++ class with a `foo` method and call that method. Or create a class with a `foo` method and call that method from C++. Probably one of the biggest hurdles to get over in C++ interopt. Most don't do that, instead you'd make a C function binding and struct and move data/invoke functions through that.

https://cxx.rs

Re:Carbon Language: An experimental successor to C++ by ridiculous_fish on Tuesday July 19, 2022 @03:52PM (#32157046)
I tried cxx and walked away somewhat disappointed.

One problem is that it's hard to understand the code. The whole thing is one giant proc macro, which is by itself tricky to run and debug. Also it uses techniques like implementing Deref to simulate inheritance which makes it even more confusing.

The main problem is the difficulty in extending it. Support for std::string and std::vector are "baked in" in a way that does not generalize. I tried to add support for std::wstring and it is quite non-trivial.

Because it is a proc macro it's also tricky to integrate into a build system.

To me it seems like Cxx is "purpose built" which is fine. But after working with it, I longed for a Python script that just populates a template string or something.

Re:Carbon Language: An experimental successor to C++ by IshKebab on Tuesday July 19, 2022 @12:49PM (#32154465)
cxx is great but it isn't anything close to what cogman10 is describing.

It actually can't ever be, because C++ has move constructors and Rust deliberately doesn't, so you can't for example return `std::string` from a Rust function by value.

Re:Carbon Language: An experimental successor to C++ by hlopko on Tuesday July 19, 2022 @04:39PM (#32157643)
It's currently unclear if Rust can interop with C++ with high fidelity. For example https://docs.rs/moveit/latest/moveit/ and https://github.com/google/crubit/blob/main/rs_bindings_from_... provide functionality to use non-trivially relocatable C++ types from Rust.
Re:Carbon Language: An experimental successor to C++ by IshKebab on Wednesday July 20, 2022 @07:42AM (#32164298)
Bit hard to follow but as far as I can tell those are pinning the C++ types and wrapping them in some other object that allows a move constructor to be called on them to move them to some other pinned location.

It still doesn't let you natively move them, and if you have to wrap them in something you may as well just wrap them in `Box<>` and not move them, which is what cxx does.

I guess maybe it makes a difference for passing things into existing C++ interfaces?

Anyway it looks insanely complicated.