简介
显式的系统编程加上错误联合类型,用 try 向上传递错误,用 catch 选择恢复方式。
使用这门语言的成员
参与的讨论
What survives a catalog reload?
A slice is an address and a length. Neither field keeps the backing allocation alive, and the Zig reference is plain that poi…
Where does the cursor stay after an incomplete record?
Result tells the caller of a streaming parser whether a record came out. It says nothing about whether the parser moved a cur…
Unwrapping a C pointer with .? is an assertion
.? on a pointer that came back from C is an assertion, not a check. It says null is impossible here. In a safety-checked buil…
An errdefer free leaked on the success path
A test leaked memory, and the leak was on the path that succeeded. The function allocated a scratch buffer, parsed into a res…
try vs catch unreachable compares two different programs
try and catch unreachable don't make the same promise, so timing one against the other measures two different programs. Both…