News for hackers. Stuff that matters.
Re:Zig, the Ideal C Replacement Or? by stephc_int13 on Sunday May 11, 2025 @09:26AM (#43953684)
I've been closely following and evaluating the train of C replacement languages that was (I believe) started by Jonathan Blow and Jai.

Zig is one of the strong contenders, but Odin is IMO following a saner path, Carbon and D should be mentioned and I think there are a few others.

My initial reaction to new programming languages is naturally skeptical, but I really liked the way the designers behind those efforts approached it, trying to solve frequent C/C++ pain points and adding a few fresh ideas.

But overall, after a few years, I am sticking with C and orthodox C++, the cost/benefit ratio is simply not worth the effort, none of them are really mature and the problems they try to solve are not painful enough.

My current take on this is to view Jai/Zig/Odin/etc. as attempted C forks, quite often motivated by hubris and coming with the usual inconvenience of forks, a lot of wasteful/redundant efforts put into small islands, each ruled by their own "benevolent" kings.

An other analogy that can be made is the many attempts at replacing keyboards layouts. Dvorak etc. They probably have their merits, but the adoption was limited to a few enthusiasts for the same reasons that C is unlikely to get replaced by any of those forks.

Re:Zig, the Ideal C Replacement Or? by 90s_dev on Sunday May 11, 2025 @09:39AM (#43953759)
> My current take on this is to view Jai/Zig/Odin/etc. as attempted C forks, quite often motivated by hubris and coming with the usual inconvenience of forks, a lot of wasteful/redundant efforts put into small islands, each ruled by their own "benevolent" kings.

Didn't Rust do the same thing? We only call efforts wasteful until they become mainstream, then in retrospect we call it excitement driven prudence.

Anyway, is there an "Odin for C programmers" short guide, so I can learn it more quickly?

Re:Zig, the Ideal C Replacement Or? by stephc_int13 on Sunday May 11, 2025 @09:45AM (#43953793)
Rust is a bit different, more like a C++ replacement and heavily focused on so-called memory safety, but with IMO many bad design decisions, while I consider Zig/Jai/Odin as merely "meh" I think that Rust is bad.
Re:Zig, the Ideal C Replacement Or? by cadu2 on Sunday May 11, 2025 @10:03AM (#43953895)
Can you comment you some of these decisions in Rust that you feel are bad? I enjoy the language and have done quite a bit of work with it so I might be blinded/biased. I feel some warts here and there (async fns, anyone?), but overall the thing works and `cargo` is really a blessing.
Re:Zig, the Ideal C Replacement Or? by stephc_int13 on Sunday May 11, 2025 @10:32AM (#43954096)
Horrendous compilation time. Unnecessary complexity everywhere, basically C++ but worse.
Re:Zig, the Ideal C Replacement Or? by bonzini on Sunday May 11, 2025 @11:11AM (#43954346)
There's a lot less complexity in Rust than C++. Compilation times are mostly due to lack of compiled code reuse, which is bad but not unsolvable.
Re:Zig, the Ideal C Replacement Or? by const_cast on Sunday May 11, 2025 @08:18PM (#43958436)
> There's a lot less complexity in Rust than C++.

Eh, I don't know, I don't think so absolutely. I think in the general "application" paths yes there's less complexity but as a language overall, no.

The thing is Rust has all the same capabilities of C++, that is to say, everything. With that same strong emphasis on free abstractions - meaning, abstractions that do not cost anything more than if you wrote the implementation yourself.

Templates and stuff are a rabbit hole but if you go down the path of procedural macros and generics in Rust it's more of the same. It gets crazy, wild, and super complex. But most people don't have to worry about that, because these sort of "squeeze every last bit of juice" features are most useful for library authors.

Re:Zig, the Ideal C Replacement Or? by pdpi on Sunday May 11, 2025 @10:05AM (#43953906)
What about Rust's memory safety story justifies the "so-called" qualifier?
Re:Zig, the Ideal C Replacement Or? by stephc_int13 on Sunday May 11, 2025 @10:31AM (#43954087)
To be clear, the design is pretty solid. But the marketing and storytelling around it is BS.

This should be called hardening and the whole "unsafe" thing is also detrimental. Computer security and exploits is a highly complex topic, there are no silver bullets. Rust code is safer to some extent, but not "safe" from bugs and exploits.

Re:Zig, the Ideal C Replacement Or? by heresie-dabord on Sunday May 11, 2025 @10:17AM (#43953989)
> the problems they try to solve are not painful enough.

The lack of safety is not painful enough? There is an entire industry (i.e. job sector, training, expertise) that evolved to try to thwart bad actors abusing unsafe languages.

Re:Zig, the Ideal C Replacement Or? by wolvesechoes on Sunday May 11, 2025 @12:47PM (#43955015)
But neither Zig nor Odin solve this problem. The only serious attempt is Rust.
Re:Zig, the Ideal C Replacement Or? by bnolsen on Thursday May 15, 2025 @07:58PM (#44000525)
Rust is super heavy handed in how it does it.
Re:Zig, the Ideal C Replacement Or? by stephc_int13 on Sunday May 11, 2025 @05:03PM (#43957141)
See. Rust fans are often naïve believers in silver bullet solutions.

Computer security and exploitation is a complex and difficult topic.

Bad actors are looking for vulnerabilities to build exploits, some are related to memory corruption but many of the most sophisticated ones are not.

All programs are potentially unsafe, regardless of the language. Using a language like Rust can help to some extent, but it won't be sufficient if the programmer is too ignorant about code hardening.

You can't replace experts with the flip of a switch.

Re:Zig, the Ideal C Replacement Or? by pjmlp on Sunday May 11, 2025 @10:28AM (#43954068)
C replacement languages have been a thing for decades, since 1978 if we don't count its predecessors, unfortunately UNIX/C is hard to beat, thankfully there is also Typescript for C, aka C++.
Re:Zig, the Ideal C Replacement Or? by pron on Sunday May 11, 2025 @10:33AM (#43954102)
I am similarly sceptical, but that's not to say these new languages cannot teach us much. I don't know if Zig or Rust would ever become as popular as C++ -- the odds are certainly stacked against them -- but they both have novel approaches that could, perhaps, introduce some ideas into programming that one day may make an impact.
Re:Zig, the Ideal C Replacement Or? by andrewmcwatters on Sunday May 11, 2025 @09:53AM (#43953838)
I feel many of your sentiments, and suspect that many C successors fail, because they don't want to just look like an evolution of C in the same way C with Classes did.

No one is out here building C with Safety.

Re:Zig, the Ideal C Replacement Or? by pjmlp on Sunday May 11, 2025 @10:29AM (#43954077)
WG14 could design such an evolutionary path, it has been obvious since 1980's, however they clearly aren't interested.
Re:Zig, the Ideal C Replacement Or? by andrewmcwatters on Sunday May 11, 2025 @02:39PM (#43955953)
Yeah, it's really disappointing. I think the general attitude is to use calls to functions that are safe and to use instrumentation, which I get, but it results in these piecemeal fixes over the years.
Re:Zig, the Ideal C Replacement Or? by pjmlp on Sunday May 11, 2025 @02:58PM (#43956105)
If only such functions would exist, instead of pointer + length.
Re:Zig, the Ideal C Replacement Or? by bnolsen on Thursday May 15, 2025 @07:56PM (#44000517)
Odin just hasn't been in the same league performance wise as rust, c, c++, zig. For these types of languages it's important.