This commit is contained in:
yuzu 2025-05-25 19:44:13 -05:00
parent f54b34dded
commit 42fdd0f53a

22
README.md Normal file
View File

@ -0,0 +1,22 @@
# explanation
* (a) Why making a JSON parser?
- I think that Zig's std.json parser fucking sucks
- I write a ton of web apps, therefore, I need a JSON parser
* (a) What's wrong with std.json?
- It is impossible to override the defaults, I'll proceed to tell you the defauls
- It parses `enums` into `strings` instead of `ints`
- `Packed structs` get parsed as structs, instead of `ints`
- `max_value_len`, couldn't they just learn how to resize a buffer? Is it so difficult?
- Strings are not dupped, you have to MANUALLY enable this
- They don't support parsing unions, laughable
- It crashes randomly when the type doesn't strictly match the payload
- `error.MissingField`, you have to annotate every 'optional' field with `= null`, do they don't know how JSON works?
- Considering what I've said so far, the type reflection is just awful, and there is no way to parse without reflection, just straigt up data? Or is there?
- Huge boilerplate to define custom parsing, if every default is overriden then the only option left is to define your own `jsonParse` function, which generates [huge boilerplate](https://git.yuzucchii.xyz/yuzucchii/discord.zig/src/commit/88088e4ae862dcce31bc212eac92b74e803c63f8/src/structures/shared.zig#L104)
- Like 10 different functions for doing the exact same thing, parsing, `innerParse`, `innerParseFromValue`, `parseFromSlice`, `parseFromSliceLeaky`, `parseFromTokenSource`, `parseFromTokenSourceLeaky` (wtf?), `parseFromValue`, `parseFromValueLeaky`
- The debug options are trash, you have to quite literally pass a struct called `Diagnostcs`
- [This](https://www.openmymind.net/Custom-String-Formatting-And-JSON-in-Zig/) article
* (a) Ok but all of your reasons are dumb
### Sic respondeo:
The Zig Discord server is plagued with modern scum, of course, modern scum will refute all of my claims or label them as "dumb" or "you're using it wrong!", has any of these individuals not considered that Zig is over complicated? There is a reason why Andrew Kelley himself detached from the communities [and has spoken in multiple instances](https://andrewkelley.me/post/goodbye-twitter-reddit.html) about the "shitification" of software communities, it's like turning a good community of like-minded programmers into a soydev shill. One good thing that he did was shutting down the r/zig subreddit.
On different note, I defend simplicity and minimalism, so I am not saying that *every* Zig developer who thinks differently is scum, I just say that if you cannot think beyond your viewpoint you will reach nowhere. Lastly, if your software is not straightforward and simple to use, then why criticising someone for now knowing how to use it? The only reasonable way to make software complicated is as long as user friendliness is not a tradeoff for performance or minimalism.