News for hackers. Stuff that matters.
Re:Zig self hosted compiler is now capable of building itself by Comevius on Saturday April 16, 2022 @02:50PM (#31054985)
The point of C and Zig is that you can solve any kind of problems with them. In particular there is much more to memory reclamation than garbage collectors or Rust's borrow checker. Some of the reclamation schemes offer wait-freedom, or efficiently support linearizable operations.
Re:Zig self hosted compiler is now capable of building itself by pjmlp on Saturday April 16, 2022 @03:02PM (#31055099)
Any kind of problem?

So how do you solve SIMD with C, without language extensions?

C is not a special snowflake.

Re:Zig self hosted compiler is now capable of building itself by Comevius on Saturday April 16, 2022 @04:01PM (#31055613)
SIMD is not a problem, it's hardware. Compilers tend to take advantage of the CPU-specific SIMD registers and instructions, or you can use them explicitly.

Writing generic SIMD code is more portable. C has libraries, and Zig also has vector primitives available through built-in functions.

Re:Zig self hosted compiler is now capable of building itself by pjmlp on Saturday April 16, 2022 @04:14PM (#31055716)
Any language can have libraries, C is not special here, nor is Zig.

In fact, a few GC enabled languages have explicit SIMD support.

Re:Zig self hosted compiler is now capable of building itself by turminal on Saturday April 16, 2022 @03:15PM (#31055193)
Are there languages that "solve" SIMD?
Re:Zig self hosted compiler is now capable of building itself by pjmlp on Saturday April 16, 2022 @04:13PM (#31055704)
Re:Zig self hosted compiler is now capable of building itself by sitkack on Sunday April 17, 2022 @06:06PM (#31064932)
Re:Zig self hosted compiler is now capable of building itself by maleldil on Saturday April 16, 2022 @04:29PM (#31055823)
What can C and Zig do that Rust can't?
Re:Zig self hosted compiler is now capable of building itself by Comevius on Saturday April 16, 2022 @04:49PM (#31055979)
Nothing if unsafe Rust is considered, though Zig does not require you to fight the language nearly as much. This is especially obvious with embedded. Zig's philosophy of no hidden control flow or allocation makes things simple. Simplicity is power.

For certain problems you would want a TLA+ specification for safety and especially liveness either way. It's not like Rust absolutely guarantees correctness in all cases.

Rust sits in a sweet spot between C/Zig and languages like Java, but it's not an appropriate replacement for either of them.

Re:Zig self hosted compiler is now capable of building itself by 3a2d29 on Saturday April 16, 2022 @11:24PM (#31058188)
Certainly Rust sits where C++ is. Zig and Rust are definitely best used for different things, but I think sweating rust off as in between C and Java is inaccurate.
Re:Zig self hosted compiler is now capable of building itself by politician on Saturday April 16, 2022 @05:53PM (#31056428)
This is kind of a trick question because they are all Turing Complete, but so is Assembly. The best way to interpret your question, then, is not “what is possible” but rather “what is simple to express correctly” and “what is simple to get correct eventually”. Those are questions about how tricky it is to get something to compile in the language and which tools exist to help determine whether a compiled program does what’s expected and does not do what’s not expected.
Re:Zig self hosted compiler is now capable of building itself by maleldil on Monday April 18, 2022 @02:10PM (#31074346)
It wasn't a trick question. I'm not asking it in the same tone as someone would ask 'What can C do that Java can't?'.

I believe that Rust can be as low level as you want. If you have to fight the language to accomplish something, it's because you're probably trying to do something unsafe, and Rust will let you do that if you pay the price.

I was looking for examples of real cases where Zig is a better option than Rust. And while Zig is a lovely language, its main points against Rust are that it lets you do unsafe things more easily, and it's easier to learn.