by andrewmcwatters · 4y ago · 0 comments
But for those of us looking for a C alternative, we have it, and it's Go. Is it a perfect replacement? I don't think so. But it is the closest spiritual successor the industry has.
"Go bears a surface similarity to C and, like C, is a tool for professional programmers, achiev- ing maximum effect with minimum means. But it is much more than an updated version of C."
"Go is sometimes described as a ‘‘C-like language,’’ or as ‘‘C for the 21st century.’’ From C, Go inherited its expression syntax, control-flow statements, basic data types, call-by-value param- eter passing, pointers, and above all, C’s emphasis on programs that compile to efficient machine code and cooperate naturally with the abstractions of current operating systems."
-Preface of "The Go Programming Language"[1][2][3]
"We’ll start with the now-traditional ‘‘hello, world’’ example, which appears at the beginning of The C Programming Language, published in 1978. C is one of the most direct influences on Go, and ‘‘hello, world’’ illustrates a number of central ideas."
- Chapter 1.1 Hello World, "The Go Programming Language"
[1]: https://go.dev/learn/#featured-books
[2]: https://www.gopl.io
I don't understand the "spiritual successor" part: Go intentionally broke ABI compatibility with the C world and intentionally does a lot of very un-C-like things: a large standard library, a GC'd runtime, a compiler toolchain that reimplements the "standard" toolchain, etc.
Go is a clear productivity, reliability, and security improvement over C. But I don't know if I would characterize it as a successor language, other than in the "came from the Bell crowd" sense. Which also applies to C++.
Edit: Go is also not well known for binary interoperability, which is one of C's main selling points.
In other words, you'd spend most of your time familiarizing yourself with the code itself, not Go.
The most productive C codebases are the ones that have existed for years, where every possible utility and type has been built from scratch out of need; Go programmers are able to be productive from the get-go.
It's obviously not a true successor as it has a GC for one, but one way I like to think about it is that if Java is in some ways a more convenient C++ for application development, if you will, then Go would be that but a more convenient C, not C++
The 'C successor' comes more from the philosophical approach of Go's core team to the language design being similar to that of C, not it being a practical successor to C as such.
Ergo successor language.
There probably is still a niche for a simpler language than Rust or C++, but I don't see Go fulfilling that niche. Zig seems like the strongest candidate here.
I believe Zig and Go's adoption is essentially capped with the compiler being this pedantic, as it overly bisects potential adopters. It is too polarizing. Some people love it, some people dislike it, but for the people who dislike it, it is enough to write off the entire language.
What exactly have you been using C for?
Go has a very heavy runtime and is garbage collected. It also cannot be embedded within other languages. Go has very different performance characteristics. Go on embedded might be possible but would be a big exercise for the reader.
I'm really not sure what you mean by Go is C alternative.
The only similarity between C and Go I see is the syntax and that there were no generics, and even that is no longer the same. The only other similarity is the need to cast to and from the equivalent of `(void *)` to get around the typechecker.
>Oh, yeah, I missed that sorry. > >>Is this not a breaking change? > >Some would argue it's a "fixing" change.
yikes. This article really speaks to so many of the pain points I had with Go; the language itself is fine but the whole standard library has so many just...odd...decisions that you don't notice until they blow your foot off when something off the happy path happens like, as the author notes, a server stops responding or your system boots with a wall time of unix epoch.
C is used for low level stuff e.g. embedded, OS, drivers. Go is GC'd which is a huge barrier. This is honestly one of the most bizarre takes I've ever seen on Rust vs Go. If I had to bet I'd say Rust will never replace C but it won't be because Go did so instead.
Rust's major influences include C++. Go's primary influence is C.
So, what are, in your opinion, the lasting concepts of C, and how does go embody them?
For people who can switch to a higher level (ie Garbage Collected) languages what does go have over Java or C# or python?