Live data from Hacker News

Zig: A new direction for low-level programming?

bitshifters.cc

51–60 of 110 posts

Re: Zig: A new direction for low-level programming?

#51
post #47
post #41

Earlier quoted context omitted.

Seatbelt laws are still wrong, government has no business protecting me from myself. But even from an utilitarian perspective, compilers do have warnings and they could just have used that.

It also protects innocent bystanders from being forced to see your horrifyingly mangled body tossed on the ground in front of them in what could otherwise have either been a crash with no injuries, minimized injuries, or at least contained injuries. Do you still think that law is overstep, if so why? Genuine question, I have no horse in this race and am on the fence myself.

Because any restriction of freedom is bad in principle and acceptance of those tend to create overreaching, totalitarian states/mafias. There are valid arguments for restricting freedom from an individual to harm another, but making sure no one can see your dead body right after you happen to crash your car definitely isn't one. It is very much infeasible and an absolute helicopter mom type of concern.

Re: Zig: A new direction for low-level programming?

#52
post #41

Earlier quoted context omitted.

This is the exact same attitude as people who threw tantrums about seatbelt laws in the 90s. It was wrong then, and it's wrong now. For mostly the same reasons.

Seatbelt laws are still wrong, government has no business protecting me from myself. But even from an utilitarian perspective, compilers do have warnings and they could just have used that.

> Seatbelt laws are still wrong, government has no business protecting me from myself.

If there are multiple people in a car and some choose to wear seatbelts and some choose not to, those who are not wearing seatbelts become a danger to everyone else as their bodies become in-vehicle projectiles.

Sure, I can understand the debate when it's just a single person in a car. But when a person's decision starts impacting others the debate is going to be very hard to win.

Re: Zig: A new direction for low-level programming?

#53

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 appr…

> 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: A new direction for low-level programming?

#54
post #20

> Of course, if you don’t use pos, the compiler will say that this is an error and refuse to compile as well. And if you discard that error (typically using _ = pos;), the compiler will complain that it should be a const. This was one of the main things that bothered me about Zig when I last tried it. This actively works against me when writing prototypes, exploratory code, and especially when writing code to learn t…

I've never even tried Zig because of this: Since the author defends this decision, it begs the question: What else is burried in the Zig language design? I don't know and I don't want to find out.

Re: Zig: A new direction for low-level programming?

#56
post #49
post #43

Earlier quoted context omitted.

Urgh this frustrates me so much. The worst part is, the recommended way to avoid these compilation problems is to add: _ = my_unused_variable; to your code. Some IDE extensions even do this automatically. But if you do that, it permanently suppresses all compiler feedback that my variable is unused! Its basically the worst of all worlds: - I can't easily prototype, or test code as I go because I keep stubbing my toe…

> (I have to do more work to test my code) I feel like that's already the cultural precedence in Zig. I mean, isn't their primary way of making sure your code fully and oncely frees all memory, just writing tons of tests that thoroughly exercise your function(s)?

Sure; but when I'm working on a complex problem, I'll often run (test) my code as I go, eyeballing the input and output to make sure I'm on the right track and its doing what I expect. The less time that passes between writing code and discovering a bug, the easier it is to find and fix the bug. Its also a great way to write tests - I'm more aware of edge cases when I've just written the code being tested.

The problem is that zig makes it hard to run the first half of a function or block of code. I've always got variables or parameters that I simply haven't put to use yet.

In an ideal world, my half-written code would fit neatly into a set of well defined functions with no unused variables. But at an experimental stage, I haven't refactored my code to make it beautiful yet. I always prefer to debug my code before refactoring it, because if my tests fail afterwards, I can isolate the bug to the refactoring process itself.

Re: Zig: A new direction for low-level programming?

#57

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 appr…

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: A new direction for low-level programming?

#58

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 appr…

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.

WG14 could design such an evolutionary path, it has been obvious since 1980's, however they clearly aren't interested.

Re: Zig: A new direction for low-level programming?

#60
post #46

Earlier quoted context omitted.

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.

What about Rust's memory safety story justifies the "so-called" qualifier?

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.

Post reply on HN