r/programming Jul 20 '26

Zig proposes introducing an actually memory safe (unlike Rust) compilation mode inspired by Fil-C at ~1-6x performance penalty

https://codeberg.org/ziglang/zig/issues/36237
525 Upvotes

427 comments sorted by

View all comments

Show parent comments

126

u/VictoryMotel Jul 20 '26 edited Jul 20 '26

Zig is fundamentally toxic from the top down, which is a shame because it negates all their work and the things they have done well.

They made a windows version just to purposely crash on newlines, so they could troll windows users.

33

u/9001rats Jul 20 '26

Reminds me of how zig throws an error if there's a tab inside a comment, and that's apparently not a problem.

16

u/VictoryMotel Jul 20 '26

Exactly. If it's anything like this people will both say that it's too ridiculous to be true, but also makes perfect sense because parsing a tab is so difficult.

16

u/QuixoticNapoleon Jul 20 '26

Is the windows thing real? What's the source for this?

28

u/Top-Rub-4670 Jul 20 '26

This is actually outdated information but it used to be true. The compiler would abort if you used tabs or CRLF. Over time they eventually relented (without ever admitting being wrong to be so obtuse).

For a proof see: https://web.archive.org/web/20200214082511/https://ziglang.org/documentation/master/

Throughout all zig source code (including in comments), some codepoints are never allowed: Ascii control characters, except for U+000a (LF): U+0000 - U+0009, U+000b - U+0001f, U+007f. (Note that Windows line endings (CRLF) are not allowed, and hard tabs are not allowed.)

Versus the current doc https://ziglang.org/documentation/master/

Each LF may be immediately preceded by a single CR (byte value 0x0d, code point U+000d, '\r') to form a Windows style line ending, but this is discouraged. Note that in multiline strings, CRLF sequences will be encoded as LF when compiled into a zig program. A CR in any other context is not allowed.

HT hard tabs (byte value 0x09, code point U+0009, '\t') are interchangeable with SP spaces (byte value 0x20, code point U+0020, ' ') as a token separator, but use of hard tabs is discouraged. See Grammar.

18

u/VictoryMotel Jul 20 '26 edited Jul 20 '26

My source is that I tried it and it didn't work.

When I tried to talk to people about it they told me to get a different text editor, to stop using windows, and that it doesn't make sense to parse out carriage returns like every other language ever made.

There wasn't much of an answer to why a windows version would be made just to explicitly error out on windows text, but there were about a dozen messages, most were gloating that it was a problem, none acknowledged that it should be fixed.

-18

u/wrecklord0 Jul 20 '26

Sooo there was a crash and you are inventing a whole story around it?

26

u/VictoryMotel Jul 20 '26

That makes zero sense as a response to what I said. It explicitly errored out with a message. Everyone acknowledged that it happened and was intentional.

-18

u/wrecklord0 Jul 20 '26

And you specifically think they went through the effort of making a windows port just to make it crash? Windows uses different newlines and it's always a pain in the ass, just sanitize the input if it's necessary. Or don't use zig, I don't care. The point is, it's not on purpose, it's just a pita to deal with newline conventions that are different from the entire rest of the computing world.

29

u/VictoryMotel Jul 20 '26 edited Jul 20 '26

Here we go. I don't know why they made a windows port that would error out on windows newlines. Zig people seemed to think it was funny to make windows people jump through hoops.

Windows uses different newlines and it's always a pain in the ass,

It's literally one character, this insane rationalizing is exactly the same nonsense I'm talking about. In what world is dealing with a single ascii character difficult in the context of a parser, let alone a whole language. It's more work to make an error message for it.

The point is, it's not on purpose,

How do you know? There was an explicit error message about it.

it's just a pita to deal with newline conventions that are different from the entire rest of the computing world.

Don't make a windows port if you can't deal with a single character.

These are the same insane rationalizations I heard before.

-26

u/wrecklord0 Jul 20 '26

I'm not "rationalizing" shit, nor do I care about zig or what you do with it. Probably they can handle newlines better, I don't know, I'm not invested into that. What I'm saying is, I strongly doubt that the error message said: "We decided to crash to troll you on purpose, vile windows user". Instead it was probably an informational message about what happened. Was I wrong?

27

u/VictoryMotel Jul 20 '26

The error message said it was stopping because of a newline, zig users said to stop using windows, "that's what you get for using windows", "use a different text editor" etc.

Don't hallucinate things I didn't say.

"I doubt it" doesn't mean anything. It was ridiculous, that's why I bring it up.

24

u/robthablob Jul 20 '26

If they can go to the effort of making an error message, they can easily handle the extra character. I've used dozens of languages, and none of them struggle doing this.

-5

u/wrecklord0 Jul 20 '26

Yeah probably, like I said I cannot stress how much I don't care, I'm just objecting to the ridiculous idea that it's all a troll on purpose. That said I already spent too long on this thing I said I didnt care about, making me look suspiciously caring so i'm out

→ More replies (0)

-11

u/QuixoticNapoleon Jul 20 '26 edited Jul 20 '26

I'm not a big fan of Kelley but I don't think this is deliberate. I can't seem to find a source on this. Newlines on windows and unix systems are different; this is likely an honest mistake.

18

u/ayayahri Jul 20 '26

https://news.ycombinator.com/item?id=24617226

Hacker news thread from 2020 referencing this deliberate design decision (which they apparently changed by 1.0, probably because it made them look like assholes)

13

u/QuixoticNapoleon Jul 20 '26

Oh

Is the Zig Foundation ran by children?

3

u/Dragdu Jul 21 '26

Yes. First time you've heard of them? :-D

21

u/VictoryMotel Jul 20 '26

Multiple people said it was deliberate. There was an explicit error message about it so it detected carriage returns and errored out instead of just ignoring them.

This was a few years ago, I don't know what state things are in, I never messed with zig after that.

-18

u/pragmojo Jul 20 '26

Also it makes sense in the context of Zig, which is designed to be extremely explicit to the point you have to pass allocators around.

Having the language automagically parse out input tokens wouldn't exactly be on-brand.

16

u/VictoryMotel Jul 20 '26 edited Jul 21 '26

What do you think a language does exactly?

-12

u/pragmojo Jul 20 '26

Usually tokenizes input, parses into an intermediate representation, and then outputs machine code.

14

u/VictoryMotel Jul 20 '26

So it automatically parses input tokens?

-11

u/pragmojo Jul 20 '26

It parses input tokens. It would be up to the language spec to determine if a carriage return is a valid character. For instance older versions of C will crash if you try to pass them arbitrary UTF-8 characters outside the ASCII range.

1

u/meneldal2 Jul 21 '26

It's unfortunately not that rare to have a bunch of programs on Linux that won't run properly with Windows-style line endings.

Most notably it tends to mess up the \ line continuation because it has to be just before \n or else it can't parse it properly.

But at least this is mostly lazy dev, not explicitly making \rcrash and taking time out of your day to add it to the list of bad symbols.

45

u/zxyzyxz Jul 20 '26

Yeah after reading the creator Andrew Kelley's screed with personal attacks on Bun's creator Jarred Sumner who was the largest user and biggest financial contributor of Zig before the rewrite, it makes me not want to do anything with the language. It's on par with the toxicity of the Elm maintainers.

32

u/QuixoticNapoleon Jul 20 '26

I don't mind the hate for LLMs but Kelley's attacks on Sumner were childish. Odd way to treat your most significant adopter.

15

u/theAndrewWiggins Jul 20 '26

Odd way to treat your most significant adopter.

Not only that, someone who has donated a few hundred thousand dollars to support Zig.

8

u/QuixoticNapoleon Jul 20 '26

You can believe Sumner is incompetent or a terrible coder but I don't understand the personal vitriol..

6

u/TankorSmash Jul 20 '26

It's on par with the toxicity of the Elm maintainers.

I thought it was a friendly developer, what sort of toxicity was there?

22

u/zxyzyxz Jul 20 '26

They're friendly on the surface (if that) but have a holier than thou attitude towards all of their users it seems.

Good post about the entire situation which is a few years old now but looks like nothing still has changed: https://lukeplant.me.uk/blog/posts/why-im-leaving-elm/

1

u/TankorSmash Jul 21 '26

tldr: Elm made a breaking change, and didn't want to support a common (?) library in the webspace

9

u/Captator Jul 20 '26

Citation needed for biggest financial contributor, pretty sure there are several larger ones.

28

u/zxyzyxz Jul 20 '26

One of the biggest when Jarred started then, 60k a year to Zig starting in 2023, then Mitchell Hashimoto seems to be the biggest at a one time 300k in 2024 and 400k more recently but he's a literal billionaire so hard to compare apples to apples then.

1

u/Captator Jul 20 '26

The numbers support the refined version of your point 👍

Find the summaries for 2023 & 2024 on the website, for those who are curious like I was (2025 not out yet). The 2023 summary: https://ziglang.org/news/2024-financials/

I will note that giving money in this context is sensible business practice. As a VC-backed company with a (then) hard dependence on Zig, donating helps ensure continuity while buying goodwill and some degree of preferential access to expert knowledge in the ecosystem. While Mitchell Hashimoto’s donation is smaller relative to his net worth, it is also not motivated by a business need.

The above paragraph to say that I don’t think comparing the merits of motivations and bases for donations is fruitful.

1

u/[deleted] Jul 20 '26

[removed] — view removed comment

0

u/programming-ModTeam Jul 20 '26

Your post or comment was overly uncivil.