In summary, functions that can fail have an inferred error set, or an explicit one[2]. At the callsite of functions that can fail will either be `if`, `while`, `catch`, or `try`, in order to deal with the error case.
Neat! So yeah, reducing Result to ! and inferring errors makes this way less boiler-plate-y. One of Rust's core design decisions is that we should never do type inference for function definitions, so we can't do this.
And yeah, if you hold a pointer to the allocator instead of parameterizing by it, that helps too. With that in mind,
In today's Rust, which is sort of what already happens; a given instance can't change the allocator, but refers to the global one. I don't have a great handle on the tradeoffs from keeping a pointer vs parameterization.
Anyway, yeah, if we allowed for inferring the error type, that would make this almost the same as Zig here. Stealing your syntax:
[1]: https://github.com/ziglang/zig/blob/e3d8cae35a5d194386eacd9a...
[2]: https://ziglang.org/documentation/master/#Error-Set-Type