Hoppetosse
Joined 7 years ago
Joined 7 years ago
Specifically for recursive descent parsers, I pass around a reference to an regular struct that acts as an ErrorInfo object, and use that to pass diagnostic information up the stack. Control flow is still managed by the error returns, any additional info goes in the parameter.
There is (was?) a proposal to add that capability to the language but Im not sure it had much traction.
One of the cooler aspects of Zig's breaking changes is that its formatting tool can automatically update your code to the new syntax.
- Zig has no hard dependency on libc, it's the user's choice whether he wants to link it or not. It ships musl libc and can build/link it for most (all?) supported targets.
- Most of Zig's standard library works on freestanding targets. No runtime needed. There are no implicit allocators, so the user must use an allocator shipped with the standard library or implement their own.
- Standard library is still in its early days but already provides a lot of functionality out of the box, from containers to io.
- Using the standard library is optional. When it is used, only what is used gets included. The standard library is built from source every time (though there is caching) and its semantic analysis basically does LTO in the codegen stage so you end up with pretty slim binaries.
Here's a couple of examples:
My plan is to integrate my changes into the original project so that it can export to desktop and web.
Doesn't work for every language, though =P