Live data from Hacker News

Carbon Language: An experimental successor to C++

docs.carbon-lang.dev

61–70 of 200 posts

Re: Carbon Language: An experimental successor to C++

#61
post #6

It's become a pet peeve of mine, but for the love of God, if anyone with input in Carbon is scanning this, what can be done to use "func" instead of "fn" as a keyword? That all-consonant keyword always makes it seem like I'm reading Hungarian notation when reading Rust for instance. An other options I've seen for instance in Pony, "fun", is already an English word with a completely different meaning. Even the "functi…

Tbh, I wonder why modern languages still have a function keyword at all, e.g.: const add = (a: i32, b: i32): i32 => a + b; ...or any variation of the arrow-function idea...

You're assuming that named lambda is the same thing as a function, which often isn't true. Unless you mean that `=>` should be ambiguous depending on scope (lambda inside a function, a function in global scope)? That would also be a bit problematic, wouldn't it?

Re: Carbon Language: An experimental successor to C++

#62
post #50

I think this page describes "what" but not "why" of Carbon. Carbon exists so that it's possible to migrate a large C++ code base, like Chrome, from C++ to something saner, incrementally. The most important attribute of Carbon is not the specifics of the syntax but the fact that it's designed to be used in a mixed C++ / Carbon code base and comes with tooling to convert as much of C++ as possible to Carbon. That's wha…

[deleted]

Re: Carbon Language: An experimental successor to C++

#63
post #26
post #6

It's become a pet peeve of mine, but for the love of God, if anyone with input in Carbon is scanning this, what can be done to use "func" instead of "fn" as a keyword? That all-consonant keyword always makes it seem like I'm reading Hungarian notation when reading Rust for instance. An other options I've seen for instance in Pony, "fun", is already an English word with a completely different meaning. Even the "functi…

What's wrong with fn? It's perfectly understandable. I don't understand what the bikeshedding about keywords like this is about.

Keywords usually are quite pronounceable, and some of them are even proper words. How do you read fn?

Re: Carbon Language: An experimental successor to C++

#64

It's strange that they sometimes use [] to specify a type, other times they use (). That doesn't look very consistent to me. I like the use of [] though, it reminds me of Scala, which I liked before they did the scala 3 fork.

[] here can be read as similar to in Rust, C#, Java, or C++ templates (but move the content after the `template` into the function declaration). It's not weird if you're familiar with generic programming (and C++ programmers, the target audience of Carbon right now, will all be familiar with it, they use it with their STL algorithms and collections if nothing else). The () is the ordinary "here is the parameter list" used in pretty much every C-syntax language. C doesn't have generics, so there are several ways people have extended that base C-ish syntax to support generics: , [], template, and a few others have all been done in the past.

https://en.wikipedia.org/wiki/Generic_programming - Worth studying up on if you're unfamiliar with it.

Re: Carbon Language: An experimental successor to C++

#65
post #34

"Longer term, we will build on this to introduce a safe Carbon subset. This will be a large and complex undertaking, and won’t be in the 0.1 design." If they can't get safety right at the design stage, they'll never get it right. We already have D and Zig in this space.

Zig is nowhere near memory safe. Even some basic semantics (passing arguments as values or references) are horribly broken. https://github.com/ziglang/zig/issues/5973

Re: Carbon Language: An experimental successor to C++

#66
post #55

Are all major programming languages going to come from corporations in web 2.0?

Web 2.0?

Probably referring to "large tech companies that grew in the Web 2.0".

Yeah, agree that it sounds slightly off initially.

Re: Carbon Language: An experimental successor to C++

#67
post #41
post #34

"Longer term, we will build on this to introduce a safe Carbon subset. This will be a large and complex undertaking, and won’t be in the 0.1 design." If they can't get safety right at the design stage, they'll never get it right. We already have D and Zig in this space.

Given that Carbon's space is "languages with full interoperability with C++," I don't think D and Zig are in that space. As to "getting it right" - things are not so simple. The emphasis on memory-safety soundness is based on some empirical hypotheses, some better founded than others, and it's unclear what "getting it right" means. From a software correctness perspective, the road to sound memory safety is as follows…

I counted the word “sound” in this reply 8 times. When I the word sound there is always the word Rust nearby. It is just a coincidence, of course.

Re: Carbon Language: An experimental successor to C++

#68

I remember back when carbon first appeared, I immediately thought it's not gonna get popular simply because it has "fn" and "var" superficial details matter - people that stayed on C++ instead of transitioning to flashy new ones have type-before-name as part of programming identity you can have all the features in the world (and be recognized by it), but if the code doesn't _look_ like C++, then it's of no interest

Well, the Carbon team primarily focusses on one customer: Google. If management decides "it's carbon now" then a few thousand developers will write carbon or change jobs. If they are then somewhat successful inside Google, people leaving will spread it.

I don't think it will reach the same distribution as other languages, as the niche is "large C++ projects, which want to transition to something else without rewrite" for anybody else there are a huge number of alternatives.

Re: Carbon Language: An experimental successor to C++

#69
post #63
post #26

Earlier quoted context omitted.

What's wrong with fn? It's perfectly understandable. I don't understand what the bikeshedding about keywords like this is about.

Keywords usually are quite pronounceable, and some of them are even proper words. How do you read fn?

fun

Re: Carbon Language: An experimental successor to C++

#70
post #43
post #36

Earlier quoted context omitted.

I think that might be true of the language committee, but there's presumably a huge crowd of people with existing c++ code bases that would like to have a different path forward than just hoping that the committee changes priorities.

That is what many of us have done moving into managed languages, with native libraries when required to do so. The remaining people driving where the language goes have other priorities in mind like reflection. The profiles that were supposed to be so much better than the Safe C++ proposal, none of them made it into C++26, and it remains to be seen if we ever will see a sensible preview implementation for C++29.

C++ 26 doesn't have the technology, but it wouldn't matter anyway because what's crucial about Rust isn't the technology it's the culture.

If WG21 were handling Rust instead f64 would implement Ord, and people would just write unsafe blocks with no explanation in the implementation of supposedly "safe" functions. Rust's technology doesn't care but their culture does.

Beyond that though, the profiles idea is dead in the water because it doesn't deliver composition. Rust's safety composes. Jim's safe Activity crate, Sarah's safe Animals crate and Dave's safe Networking crate compose to let me work with a safe IPv6-capable juggling donkey even though Jim, Sarah and Save have never met and had no idea I would try that.

A hypothetical C++ 29 type safe Activity module, combined with a thread safe Animals module, and a resource leak safe Networking module doesn't even get you something that will definitely work, let alone deliver any particular safety.

Post reply on HN