Live data from Hacker News

Carbon’s most exciting feature is its calling convention

foonathan.net

11–20 of 223 posts

Re: Carbon’s most exciting feature is its calling convention

#11
post #7
post #3

Earlier quoted context omitted.

You’re certainly not the only one. It’s a confusing choice of naming.

I hope they picked that name for the same reason Apple picked it: because all life is built on carbon.

Or because Carbon as an element is "C" and "C" is also the language the framework was built for.

Re: Carbon’s most exciting feature is its calling convention

#12
post #5
post #3

Earlier quoted context omitted.

You’re certainly not the only one. It’s a confusing choice of naming.

I think the statute of limitations on “confusing name” when Mac OS Carbon was removed from OS X 10 years ago has passed.

Since those old operating systems are now vintage or retro, there have been a few people porting things like Rust, Go and Swift to older Mac OS versions (the ones that use the Toolbox ROM) which was also in the news here.

There is of course no 'registry of allowed names that have aged-out' but there are probably other creative names one could come up with.

Re: Carbon’s most exciting feature is its calling convention

#14
post #6

I really think the most exciting feature of Carbon (indeed, it's justification for existence) is its backwards compatibility with C++, followed closely by it's more modern and flexible governance structure. Even the docs in the repo say you should avoid Carbon unless you have lots of C++ code you need to interact with.

Some of the biggest problems with C++ come from its backwards compatibility with C. Yes, it wins you users in the short term, but it's a pain to support as both languages evolve

Re: Carbon’s most exciting feature is its calling convention

#15
Maybe I'm missing something, but I don't see what's special about Carbon here. In C++ the compiler can also optimize pass-by-const-reference to pass-by-value, and they do. It just can't do it across an ABI boundary, but that should only be an issue with dynamic libraries, and Carbon has to follow the standard ABI there as well. Just make sure the compiler knows it doesn't have to follow the standard ABI for every symbol in your program, e.g. by enabling LTO and setting -fvisibility=hidden. See what happens `add` is made static: https://godbolt.org/z/KsqxP5Pxh (I also had to change foo() to avoid the compiler hardcoding the result of the single call in `add`).

Re: Carbon’s most exciting feature is its calling convention

#19

Maybe I'm missing something, but I don't see what's special about Carbon here. In C++ the compiler can also optimize pass-by-const-reference to pass-by-value, and they do. It just can't do it across an ABI boundary, but that should only be an issue with dynamic libraries, and Carbon has to follow the standard ABI there as well. Just make sure the compiler knows it doesn't have to follow the standard ABI for every sym…

>Maybe I'm missing something, but I don't see what's special about Carbon here.

It's nothing really out of the ordinary ... also that particular optimization is meager in practice (on the order of 1%?). I know everything improvement adds up, but the author talks about it as if it was a game changer. I like the enthusiasm, though :D.

Post reply on HN