Live data from Hacker News

Carbon Language: An experimental successor to C++

docs.carbon-lang.dev

141–150 of 200 posts

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

#141

Earlier quoted context omitted.

> I think this page describes "what" but not "why" of Carbon. Maybe the page was updated recently, but there is a "why" link near the top: https://docs.carbon-lang.dev/#why-build-carbon What I would like to see is more documentation on the "why not" that summarizes why other languages and proposals are not sufficient. For example, Safe C++ proposal[1] appears to satisfy all requirements, but I can't find any referenc…

Did Safe C++ ever have a full, correct, fully compliant, reference implementation, or was there only (closed-source) Circle as some kind of reference implementation? Circle, as far as I know, is closed-source.

Most languages including C and C++, had leading closed source implementations, that is why being standardised by ISO mattered.

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

#142
post #106

Earlier quoted context omitted.

Swift can also 2-way operate with C++. Its coverage of the C++ language is incomplete but I suspect it might outpace Carbon.

I really struggle to imagine an organisation that shepherds a large and venerable C++ codebase migrating over to Swift. For all of C++'s faults, it is an extremely stable and vendor-independent language. The kind of organisation that's running on some C++ monolith from 1995 is not going to voluntarily let Apple become a massive business risk in return for marginally nicer DX. (Yes, Swift is OSS now, but Apple pays th…

I saw organizations in the past do that with Java and .NET, moving away from C++.

It is perfectly feasable for companies that are full commited into Apple ecosystem.

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

#143
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…

> It's not possible to port a millions line C++ code base, like Chrome, to another language so large C++ projects are stuck with objectively pretty bad language and are forced to continue to use C++ even though a better language might exist. One good aspect about C++ is its backwards compatibility or stability. Also a drawback, but companies not having to spend huge amounts of time, expertise and money rewriting thei…

I can write C++98 or C++11 code that will fail in a C++23 compiler, because C++ also isn't 100% backwards compatible.

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

#144
post #78
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…

> That's what makes Carbon different from any other language: D, Zig, Nim, Rust etc. I know you can compile C++ files to object files, pass them to the D compiler, and have them call eachothers' functions. I've never tried it though. -------- g++ -c foo.cpp dmd bar.d foo.o -L-lstdc++ -------- https://dlang.org/spec/cpp_interface.html

It's a great feature, and D has a bunch of support for this kind of thing.

But D and C++ have just enough differences to make extern(C++) not be automatic. It can take some pretty arcane metaprogramming to get things to work, and some things are impossible.

It's also worth pointing out that D isn't trying to be fully compatible with C++.

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

#146
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.

I don't even code in kotlin but I know that kotlin has function as fun :P Such small things as using __ __ in python and small inconveniences (lua's 1 instead of 0) really has a lot of people, what do I say.. yea, polarized on this matter.

0 vs 1 indexing has an actual semantic difference that you have to keep in your head at ~all times, but could have a text editor plugin that rewrites funcfn since it's purely syntactical.

What is inconvenient about it?

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

#147

Earlier quoted context omitted.

I remember reading that google tried to impress on WG21 and 14 the need to update the ABI and they were utterly opposed. The result is google is no longer interested in C++. Apple I think is also no longer interested in C++. I think also Swift now has a stable ABI.

A good write up of that is at https://cor3ntin.github.io/posts/abi/

It's implied if you know, but Corentin's post doesn't actually link Titus's C++ proposal P1863 "ABI: Now or Never" which is what we're most concretely talking about here.

Titus correctly predicts the committee's actual response and highlights its danger, summarised in the title. You can pick now, as Corentin desires. You can pick never, which Corentin despairs at - not unreasonably because it means you're giving up performance. But Titus highlights the third option, the committee can instead dither forever never having the courage to announce an ABI break but also lacking courage to declare absolute stability with the encouragement that brings for legacy systems.

ABI Now is - at least in performance - competing with Rust. An ABI swap can make some C++ have the same performance as the analogous Rust which wasn't possible with the old ABI and that matters for outfits like Google.

ABI Never is a different niche. Guaranteed ABI stability gives C++ certainty. It makes C++ a stronger contender for some applications where today it can't go and nor can Rust because people don't think "Just recompile" is a reasonable choice, whether they are correct or not.

ABI Dither is neither of these things. There is no certainty, just because the committee is dithering today doesn't mean they won't make a decision tomorrow, or next year. But meanwhile you're not competitive with the best in class alternatives

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

#148
post #81
post #76

Earlier quoted context omitted.

> 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. It means eliminating undefined behavior, and unplanned interaction between distant parts of the program.

Eliminating undefined behaviour is a means to an end (reduces problematic bugs, but not all undefined behaviour is equally responsible to such bugs), and it's not a binary thing (virtually all programs need to interact with software written in languages that don't eliminate undefined behaviour, so clearly there's tolerance to the possibility of undefined behaviour). Don't get me wrong - less undefined behaviour is be…

By definition all the C++ Undefined Behaviour is unbounded. You may believe, and even you may have practical evidence for the compilers which happen to exist today, that in some cases the behaviour in fact bounded, but that's not what the language definition says and optimisers have a funny way of making fools of people who mistake Undefined for "Eh, it'll probably do what I meant".

It might seem as though incrementing a signed integer past its maximum can't be as problematic as a use after free even though both are Undefined Behaviour, but nah, in practice in real C++ compilers today they can both result in remote code execution.

There is a place for Unspecified results, for example having it be unspecified whether a particular arithmetic operation rounds up or down may loosen things up enough that much faster machine code is generated and well, the numbers are broadly correct still. But that's not what Undefined behaviour does.

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

#149
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…

> It's not possible to port a millions line C++ code base, like Chrome, to another language so large C++ projects are stuck with objectively pretty bad language and are forced to continue to use C++ even though a better language might exist. One good aspect about C++ is its backwards compatibility or stability. Also a drawback, but companies not having to spend huge amounts of time, expertise and money rewriting thei…

> Rust is often somewhat stable, but not always.

> https://internals.rust-lang.org/t/type-inference-breakage-in...

> https://github.com/rust-lang/rust/issues/127343

> 300 comments on Github.

> https://github.com/NixOS/nixpkgs/pull/332176

Might worth noting that this change technically doesn't violate Rust's stability guarantees since type inference changes and/or adding new impls are exempt. Of course, that doesn't really help with the question of whether this change should have been made in the given timeframe (as opposed to the socket struct change IIRC?), but that ship has long sailed.

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

#150
post #132

Earlier quoted context omitted.

We have zero disagreement here (actually true of all responses to my comment - an odd circumstance on HN). What you call "`ref` types" is what I meant by "GC'd types". I actually like that the Nim compiler changed from `--gc=X` to `--mm=X` a while back as the key distinction is (& has always been ) "automatic vs. manual". Elaborating on this cross-talk, any academic taxonomy says reference counting is a kind of GC. {…

The open addressed hash tables basically don't exist for a long time. The various strategies for collision handling in these tables are from the 1980s or later and if you don't have a collision strategy you can't use this as a general purpose container. I'm pretty sure I never used a hash table which didn't use separate chaining until at least the 1990s and perhaps later. So that's maybe a bad example. In the same wa…

I can't speak to what libraries you used, but both techniques have been broadly used in common practice since the 1950s. According to the "History" subsection in Knuth TAOCP v3 at the very end of 6.4 (whose very first edition written in 1972 covered OA with various probe/collision strategy ideas), both open addressing & separate chaining were co-invented at IBM in 1953/54 by Luhn & Amdahl. You may be confusing the Celis 1985 Robin Hood hashing work with just the open addressing part? Anyway, as you say, it may be a strained example/analogy. "OO" & "concurrency" both have a lot going on, too.

Anyway, like the "major" modes of hash collision resolution, reference counted GC has also been around concurrently (haha) with ref tracing GC since the dawn of modern computing. Unix hard-links (& other things) codify ref counting into filesystems.. Python has always had ref-counted GC, older Lisp more focused on tracing GC, etc., etc. Popularity measures are notoriously difficult.

Mostly people like to abbreviate { like having a search $PATH instead of using /bin/foo everywhere }. The whole point of abstraction is to neglect details. Neglect naturally leads to forgetting (or never learning/knowing). Ignorance leads people to cross-talk (or worse willfully misinterpret/project). Cross-talk leads to suffering. Yoda out. ;-)

EDIT: Also, speaking of abbreviation & clarity, in Nim "arc" has, at least until this writing, always stood for Automatic Reference Counting, not Atomic Ref Counting as seems the more rusty terminology and is vaguely suggested by @miguel_martin, to whom I originally replied with an "arc/atomicArc", though it seems like, in Nim 3, it may become both Automatic & Atomic, but probably not changing its abbreviation to "AARC".

Post reply on HN