News for hackers. Stuff that matters.
Re:Zig – Type Resolution Redesign and Language Changes by lerno on Wednesday March 11, 2026 @07:49AM (#47334400)
> However we value explicitness and allow the developer to do anything they need to do*

* except for having unused variables. Those are so dangerous the compiler will refuse the code every time.

Re:Zig – Type Resolution Redesign and Language Changes by nulltype on Wednesday March 11, 2026 @08:36AM (#47334763)
It’s hard to say that one needs unused variables.
Re:Zig – Type Resolution Redesign and Language Changes by duped on Wednesday March 11, 2026 @09:57AM (#47335645)
If I comment out sections of code while debugging or iterating I don't want a compile error for some unused variable or argument. Warning. fine, but this happens to me so frequently that the idea of unused variables being an error is insane to me.
Re:Zig – Type Resolution Redesign and Language Changes by CyberDildonics on Wednesday March 11, 2026 @01:14PM (#47338337)
It is insane and you are completely right. This has been a part of programming for over 50 years. Unfortunately you aren't going to get anywhere with zig zealots, they just get mad when confronted with things like this that have no justification, but they don't want to admit it's a mistake.
Re:Zig – Type Resolution Redesign and Language Changes by gf000 on Wednesday March 11, 2026 @03:26PM (#47340033)
But even the solutions would be so trivial - have a separate 'prod' compiler flag. With that, make these errors, without make these warnings.

Problem solved, everyone happy.

Re:Zig – Type Resolution Redesign and Language Changes by CyberDildonics on Wednesday March 11, 2026 @04:14PM (#47340825)
You are right of course, the solution is trivial.

They also made a carriage return crash the compiler so it wouldn't work with any default text files on windows, then they blamed the users for using windows (and their windows version of the compiler!).

It's not exactly logic land, there is a lot of dogma and ideology instead of pragmatism.

Some people would even reply how they were glad it made life difficult for windows users. I don't think they had an answer for why there was a windows version in the first place.

Re:Zig – Type Resolution Redesign and Language Changes by thezipcreator on Thursday March 12, 2026 @01:25AM (#47346841)
I'm not sure why you shouldn't make your compiler accept CRs (weird design decision), but fixing it on the user-side isn't exactly hard either. I don't know an editor that doesn't have an option for using LF vs CRLF.

The unused variable warning is legitimately really annoying though and has me inserting `_ = x;` all over the place and then forgetting to delete it, which is imo way worse than just... having it be a warning.

Re:Zig – Type Resolution Redesign and Language Changes by CyberDildonics on Thursday March 12, 2026 @10:45AM (#47351314)
I don't know an editor that doesn't have an option for using LF vs CRLF.

And I don't know any other languages that don't parse a carriage return.

The point is that it was intentionally done to antagonize windows even though they put out a windows version. Some people defend this by saying that it's easy to turn off, some people defend it by saying windows users should be antagonized.

No zig people ever said this was a mistake, it was all intentional.

I'm never going to put up with behavior like that with the people making tools actively working against me.

Re:Zig – Type Resolution Redesign and Language Changes by thezipcreator on Thursday March 12, 2026 @03:11PM (#47355662)
> And I don't know any other languages that don't parse a carriage return.

fair enough.

Re:Zig – Type Resolution Redesign and Language Changes by dnautics on Thursday March 12, 2026 @10:32AM (#47351086)
i think the plan is to make no distinction between error and warning, but have trivial errors still build. that said i wouldn't be surprised if they push that to the end because it seems like a great ultrafilter for keeping annoying people out so they don't try to influence the language.
Re:Zig – Type Resolution Redesign and Language Changes by rllj on Wednesday March 11, 2026 @08:38AM (#47334795)
They are indeed dangerous, and I think this is a pretty good example of why.

https://andrewkelley.me/post/openzfs-bug-ported-zig.html

Re:Zig – Type Resolution Redesign and Language Changes by gabriela_c on Wednesday March 11, 2026 @10:32AM (#47336065)
Same for kernel drivers
Re:Zig – Type Resolution Redesign and Language Changes by dnautics on Wednesday March 11, 2026 @01:51PM (#47338832)
don't know if it's still on the table, but Andrew has hinted that the unused variables error may in the future still produce an executable artefact but return an nonzero return code for the compiler. And truly fatal errors would STILL produce an executable artefact too, just one that prints "sorry this compilation had a fatal error" to stdout.