News for hackers. Stuff that matters.
Re:Why is Zig so Cool? by kps on Saturday November 08, 2025 @10:42AM (#45857444)
Another way to look at this example is that, for the parser, this is not an error. The parser is doing its job correctly, providing an accurate interpretation of its input, and for the parser, this is qualitatively different from something that prevents it doing its job (say, running out of memory).
Re:Why is Zig so Cool? by skybrian on Saturday November 08, 2025 @11:09AM (#45857668)
At the next level up, though, there might be code that expects to be able to read a JSON config file at a certain location, and if it fails, it’s reasonable to report which file it tried to read, the line number, and what the error was.
Re:Why is Zig so Cool? by kps on Saturday November 08, 2025 @02:44PM (#45859374)
Sure, but that's a different level with different considerations. The JSON parser shouldn't care about things like ‘files’ with ‘locations’; maybe it's running on some little esp8266 device that doesn't have such things.